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' );

沒有留言:

張貼留言