WooCommerce script to add weight of packaging to total cart
- or -
Post a project like this304
£25/hr(approx. $31/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
Surat
1550+ Projects (iOS | Android | Mac OS | Web | Win | BlockChain | IOT)
Bad Vilbel
1352994600079685701763653319813285853608620944
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% (18)Projects Completed
28
Freelancers worked with
27
Projects awarded
47%
Last project
13 Mar 2024
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