• paleszp

    (@gaborpalko)


    Hello,

    I use a custom code for show the weight of products in cart. It’s good for me to calculate the EPR tax in Hungary, but my code isn’t work with composite product.

    • The whole weight depends on the parts. I know the weight of every single composite, but I want show in summarize.
      Could you please help how find I the whole weight of composite product?

    Thanks! Gabor

    /** weight of product in chart **/
    add_filter( 'woocommerce_get_item_data', 'displaying_cart_items_weight', 10, 2 );
    function displaying_cart_items_weight( $item_data, $cart_item ) {
        $item_weight = $cart_item['data']->get_weight() * $cart_item['quantity'];
        $item_data[] = array(
            'key'       => __('Weight', 'woocommerce'),
            'value'     => $item_weight,
            'display'   => $item_weight . ' ' . get_option('woocommerce_weight_unit')
        );
        return $item_data;
    }

    The page I need help with: [log in to see the link]

  • The topic ‘Weight of composite product’ is closed to new replies.