Shipping Class Conditional Tag for WooCommerce

This PHP code enables you to set a conditional check based on one or more shipping class i.d’s.

The code loops through the cart contents looking for your shipping class id ( $shipping_class_id ) and sets the value for the $in_cart variable to true if it finds it enabling you to execute code based on your set shipping class or an array of classes.

If not found, your code will not run.

How to Find Shipping Class ID

In your WordPress dashboard, go to WooCommerce > Settings > Shipping > Shipping Classes > Shipping Class and inspect the name of your shipping class like this :

How To Find Shipping Class I.D

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.