• Resolved Peachyme

    (@peachyme)


    Hello, is there a way to show the total cart weight next to the cart dollar amount?

    I need my customers to know how many pounds they are ordering in total.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi! You can do this with a small code snippet:

    
    add_filter( 'wpmenucart_menu_item_a_content', 'wpmenucart_add_cart_weight', 10, 4 );
    function wpmenucart_add_cart_weight ( $menu_item_a_content, $menu_item_icon, $cart_contents, $item_data ) {
        $cart_weight = wc_get_weight( WC()->cart->get_cart_contents_weight(), 'lbs' );
        $menu_item_a_content .= sprintf(' - <span class="cart-weight">%s</span>',wc_format_weight($cart_weight));
    
        return $menu_item_a_content;
    }
    

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Have a great weekend!

    • This reply was modified 5 years, 6 months ago by Ewout. Reason: changed to lbs
Viewing 1 replies (of 1 total)
  • The topic ‘Adding total cart weight to mini cart’ is closed to new replies.