Created
May 27, 2020 05:17
-
-
Save rajeshsingh520/e401fc146a746b611efff9c6f0eff469 to your computer and use it in GitHub Desktop.
hide free shipping bar if certail shipping class product is present in the cart
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
<?php | |
add_filter('pisol_fsnw_final_ajax_filter', 'disableFreeShippingBarForClassOfProduct'); | |
function disableFreeShippingBarForClassOfProduct($json){ | |
$shipping_classes = array(128); // shipping class id for which the free shipping bar will be hidden | |
$if_exists = false; | |
foreach( WC()->cart->cart_contents as $key => $values ){ | |
if( in_array( $values[ 'data' ]->get_shipping_class_id(), $shipping_classes ) ){ | |
$if_exists = true; | |
} | |
} | |
if( $if_exists ) return false; | |
return $json; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment