<?php | |
/** | |
* WooCommerce | |
* -------------- | |
* | |
* Display cart total weight on the cart page | |
* | |
*/ | |
add_action('woocommerce_cart_collaterals', 'myprefix_cart_extra_info'); | |
function myprefix_cart_extra_info() { | |
global $woocommerce; | |
echo '<div class="cart-extra-info">'; | |
echo '<p class="total-weight">' . __('Total Weight:', 'woocommerce'); | |
echo ' ' . $woocommerce->cart->cart_contents_weight . ' ' . get_option('woocommerce_weight_unit'); | |
echo '</p>'; | |
echo '</div>'; | |
} |
This comment has been minimized.
This comment has been minimized.
Newbie alert: Where do I insert this? |
This comment has been minimized.
This comment has been minimized.
I think you should add the code in the function.php of your theme, miltersen. |
This comment has been minimized.
This comment has been minimized.
HI.. can anybody show me the path to where the code needs to be inserted? Thanks |
This comment has been minimized.
This comment has been minimized.
this works very well, but i want to place before total Thnks before.. |
This comment has been minimized.
This comment has been minimized.
in "plugins->woocommerce->templates->cart->cart-totals.php"
|
This comment has been minimized.
This comment has been minimized.
Just wanted to say that even though I'm a visual designer with very little coding experience, this worked out fabulously. Especially the code by @javiercb. Many thanks. |
This comment has been minimized.
This comment has been minimized.
Hi, owlonline commented on 9 Sep 2013 wrote I would like to also show the weight of each item in the cart as well. Ideally just below the item name. What would be the code for that? - I am also looking to do this, do we have an answer |
This comment has been minimized.
This comment has been minimized.
Don't make any changes in the Plugin files. Just add the below code in Function.php file:
/**
* Add Cart Weight to Cart and Checkout
*/
function wcw_cart() {
global $woocommerce;
|
This comment has been minimized.
This comment has been minimized.
Hi thanks for this! - Do you know how can i set the weight with a "comma" "," instead a "dot" "."? - alex |
This comment has been minimized.
This comment has been minimized.
Super nice snippet, thanks. |
This comment has been minimized.
This comment has been minimized.
Hello @protorob , were you able to find a solution for your query ? I'm having the same problem and were wondering if you could share your findings with me, if you don't mind. Thanks, -nbvcw |
This comment has been minimized.
This comment has been minimized.
Hi @nbvcw - you can use this plugin instead: https://wordpress.org/plugins/woo-cart-weight/ |
This comment has been minimized.
Awesome. this works very well - thanks! I would like to also show the weight of each item in the cart as well. Ideally just below the item name. What would be the code for that?