Created
April 13, 2019 03:41
-
-
Save Musilda/ecdcddf3be27f856e59889f93cef0cb9 to your computer and use it in GitHub Desktop.
This file contains 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( 'zasilkovna_shipping_cost', 'hide_zasilkovna_for_big_package' ); | |
function hide_zasilkovna_for_big_package( $cost ){ | |
$items = WC()->cart->get_cart(); | |
foreach($items as $item => $values) { | |
$_product = wc_get_product( $values['data']->get_id() ); | |
$lenght = $_product->get_length(); | |
if( $lenght > 50 ){ | |
$cost = false; | |
} | |
} | |
return $cost; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment