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;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…