Skip to content

Instantly share code, notes, and snippets.

@Musilda
Created April 13, 2019 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Musilda/ecdcddf3be27f856e59889f93cef0cb9 to your computer and use it in GitHub Desktop.
Save Musilda/ecdcddf3be27f856e59889f93cef0cb9 to your computer and use it in GitHub Desktop.
<?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