Add Extra Weight with Order Total If Particular Shipping Class Exist in Order with UPS WooCommerce Shipping
#1 WooCommerce UPS Shipping plugin that offers unparalleled features like Automatic Shipping Label, Return Label generation, Shipment Tracking, and Multi-Vendor Support.
- 6,000+ Active Installs
- 100+ Customer Reviews
- 97% Customer Satisfaction Rating
This code enables you to add extra weight with order total if particular shipping class exist in the order when you are using our UPS WooCommerce Shipping Plugin.
Code snippet should be added in the functions.php file of your website theme. To do this, go to Appearance > Editor > Theme Functions (functions.php).
Code snippet for Label package
In the above code, alter the variables for shipping class (‘shipping-class-a’;) and the extra weight to add ($weight_to_add = 25;) according to your preferences.
Also note, there is no single node of total weight in the UPS request. So this snippet will distribute the weight to all packages in the case of multiple packages. It will divide by the number of packages and add the result to the weight of every package.
Code snippet for Rate Package
To know more about the product, check out WooCommerce UPS Shipping Plugin with Print Label.