Hi,
Right now I’m using the ‘Snippets‘-plugin with the following piece of code to hide a shipping class in the cart.
add_filter( 'woocommerce_package_rates', 'loods3_hide_free_shipping_for_shipping_class', 10, 2 );
function loods3_hide_free_shipping_for_shipping_class( $rates, $package ) {
foreach ( WC()->cart->get_cart_contents() as $key => $values ) {
if ( $values[ 'data' ]->get_shipping_class_id() === 0 ) {
unset( $rates['flat_rate:1'] );
}
}
return $rates;
}
Is this also possible with GP-elements and hooks? How?
Would be nice if I could remove Snippets. The fewer plugins the better isn’t it.