The following example adds a $10 surcharge to a shipping option for every bulky item in the cart. The bulky items are assigned to a shipping class so they can be referenced in this code snippet. You can change these settings to suit your needs at the beginning of the snippet like so:
- Line 13: The shipping option’s ID
- Line 14: The shipping class slug/ID
- Line 15: The surcharge for these items
This example uses a shipping ID from the Table Rates for WooCommerce plugin. Learn how to find your shipping option’s ID here.