Skip to content

Instantly share code, notes, and snippets.

@NiklasHogefjord
Created July 29, 2013 13:33
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NiklasHogefjord/6104328 to your computer and use it in GitHub Desktop.
Save NiklasHogefjord/6104328 to your computer and use it in GitHub Desktop.
WooCommerce - Display cart total weight on the cart page
<?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>';
}
@nbvcw
Copy link

nbvcw commented Jan 21, 2020

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

@ospiotr
Copy link

ospiotr commented Jan 30, 2020

Hi @nbvcw - you can use this plugin instead: https://wordpress.org/plugins/woo-cart-weight/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment