This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_package_rates', 'wf_remove_shipping_options_for_particular_zip_codes', 10, 2); | |
function wf_remove_shipping_options_for_particular_zip_codes($rates, $package) | |
{ | |
global $woocommerce; | |
$excluded_zip_array = array( | |
'93999' | |
); | |
if (in_array($woocommerce->customer->get_shipping_postcode() , $excluded_zip_array)) { | |
unset($rates['wf_fedex_woocommerce_shipping:FEDEX_GROUND']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_package_rates', 'wf_hide_undesired_service_for_required_states', 10, 2); | |
function wf_hide_undesired_service_for_required_states($rates, $package) | |
{ | |
$exclude = array( | |
'international_delivery' => array( | |
'CA' | |
) , | |
'wf_fedex_woocommerce_shipping:FEDEX_GROUND' => array( | |
'FL' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_package_rates', 'show_shippingpro_method_when_shipping_class_product_is_in_cart', 10, 2 ); | |
function show_shippingpro_method_when_shipping_class_product_is_in_cart( $available_shipping_methods, $package ) { | |
$shipping_class_ids = array( | |
16); | |
$shipping_services_to_show = array( | |
'wf_woocommerce_shipping_pro:Group1Express', | |
'wf_woocommerce_shipping_pro:group2Standard', | |
); | |
$shipping_services_to_show = array_map('strtolower', $shipping_services_to_show); | |
$shipping_class_exists = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_package_rates', 'wf_remove_shipping_pro_rate_when_free_shipping_is_applicable', 10, 2); | |
function wf_remove_shipping_pro_rate_when_free_shipping_is_applicable($rates, $package) | |
{ | |
if (isset($rates['free_shipping'])) { | |
foreach($rates as $ratekey => $ratevalue) { | |
if (strpos($ratekey, 'wf_woocommerce_shipping_pro:') !== false) { | |
unset($rates[$ratekey]); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('woocommerce_package_rates', 'hide_shipping_method_when_shipping_class_product_is_in_cart', 10, 2); | |
function hide_shipping_method_when_shipping_class_product_is_in_cart($available_shipping_methods, $package) | |
{ | |
// Shipping class IDs that need the method removed | |
$shipping_class_ids = array( | |
1111, | |
2232, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fedex Block Services for particular Zip Codes. | |
// Unset the shipping options of shipping method. | |
// You can find the shipping service codes by doing inspect element using | |
// developer tools of chrome. Code for each shipping service can be obtained by | |
// checking 'value' of shipping option. | |
add_filter('woocommerce_package_rates', 'wf_remove_shipping_options_for_particular_zip_codes', 10, 2); | |
function wf_remove_shipping_options_for_particular_zip_codes($rates, $package) | |
{ |
NewerOlder