2017年10月15日 星期日

woocommerce綠界整合

顯示超商取貨 在/home/zenzoneg/public_html/goodwayservice.com/wp-content/themes/twentyseventeen/functions.php 增加以下 /** * 免運自動選擇 Hide shipping rates when free shipping is available. * Updated to support WooCommerce 2.6 Shipping Zones. * * @param array $rates Array of rates found for the package. * @return array */ add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 100 ); function hide_shipping_when_free_is_available( $rates ) { $free = array(); foreach ( $rates as $rate_id => $rate ) { if ( 'free_shipping' === $rate->method_id ) { $free[ $rate_id ] = $rate; break; } } /* 以下為需要新增修正的部份 */ // 免運費時 仍顯示超商取貨 if (!empty($free)) { foreach ( $rates as $rate_id => $rate ) { if ( 'ecpay_shipping' === $rate->method_id ) { $free[ $rate_id ] = $rate; break; } } } /* 以上為需要新增修正的部份 */ return ! empty( $free ) ? $free : $rates; } /** 此段結束 */ add_filter( 'excerpt_more', 'twentyseventeen_excerpt_more' );

2017年10月14日 星期六

如何在woocommerce的結帳頁面製作縣市區域下拉選項

自動抓縣市區號,在主題下的functions.php加下面這段 路徑 : 網站//wp-cotent/themes/twentyseventeen-child/functions.php add_filter("woocommerce_after_checkout_form", "twzipcodefield_shipping"); function twzipcodefield_shipping() { $output = ' '; echo $output; } 下方這段要在布景主題-->自訂-->css 中加上,就可以不顯示某些欄位,但沒有移除掉 .woocommerce-billing-fields #billing_country_field {display: none;} .woocommerce-billing-fields #billing_company_field {display: none;} .woocommerce-billing-fields #billing_address_2_field {display: none;} .woocommerce-shipping-fields #shipping_country_field {display: none;} .woocommerce-shipping-fields #shipping_company_field {display: none;} .woocommerce-shipping-fields #shipping_address_2_field {display: none;}