I'm having difficulty with the shipping classes in WooCommerce. It's a webshop containing products for mailbox and packages.
However, if the cart contains 3 or more "mailbox" products, then the shipping class should change to "package".
I've tried changing the code from this question: Change shipping class based on cart items shipping class count in Woocommerce , but I couldn't figure it out.
Can someone help me with this?
$cart_item['data']->set_shipping_class_id('0');
to a different ID, which didn't work. I tried to add a shipping class$package_shipping_class = 'package';
and place it as$cart_item['data']->get_shipping_class() ==$package_shipping_class );
on the last line (so instead of$cart_item['data']->set_shipping_class_id('0');
Then when I go to my cart and I add 3 products it just says the label "Shipping costs" with actually adding shipping costs. – Shanice