
WooCommerce script to add weight of packaging to total cart
- or -
Post a project like this756
£25/hr(approx. $34/hr)
- Posted:
- Proposals: 7
- Remote
- #3962883
- Completed
UK'S No.1 - Wordpress|Magento|PHP| Responsive | PSD to responsive html | All Time Top Rated freelancer on PPH | 100% client satisfaction | Ecommerce | SEO




Top Cert WordPress|Shopify|Wix|PHP|React JS|Full Stack| Developer|177 (5stars) and only single (4stars)

1550+ Projects (iOS | Android | Mac OS | Web | Win | BlockChain | IOT)

1352993198132858536017636538620944968570460007





Description
Experience Level: Intermediate
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 weight
add_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
I have seen this script online but it doesn't seem to work:
// Filter to add packaging weight to total weight
add_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

Chris P.
100% (19)Projects Completed
29
Freelancers worked with
28
Projects awarded
46%
Last project
19 Feb 2025
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies