WooCommerce script to add weight of packaging to total cart

30.0 GBP

30.0 GBP peopleperhour Technology & Programming Overseas
333 days ago

Description

I would like a script for the functions.php file, or a stand alone plugin, that allows me to add the weight of the packaging (530g) to the total weight of the cart.
I have seen this script online but it doesn't seem to work:
// Filter to add packaging weight to total weightadd_filter( 'woocommerce_cart_contents_weight', 'prefix_filter_cart_contents_weight' );function prefix_filter_cart_contents_weight( $weight ) { /* Add 500 units to the total cart weight */ return $weight + 530;}
Another similar script here is but I can't get this to work either:https://stackoverflow.com/questions/64416812/filter-woocommerce-cart-contents-weight-not-applied-for-shipping-weight
Many Thanks
Chris

关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now

Similar Teleworks