Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using woocommerce with composite product plugin.

I have managed to display simple product weights in the cart using the below code, but it doesn't want to display an assembled composite product.

Any help would be greatly appreciated.

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;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.5k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...