Custom cart item data not stored in last version
-
Hi,
since last update code does not work anymore, this is an example of my custom code :
add_filter( 'woocommerce_get_item_data', 'custom_get_item_var_data' , 10, 2 ); add_filter( 'woocommerce_add_cart_item_data', 'custom_add_to_var_cart_product' , 10, 2 ); function custom_get_item_var_data( $other_data, $cart_item_data ) { if ( isset( $cart_item_data['myCustomData'] ) ) { $other_data[] = array( 'name' => 'My custom data', 'value' => $cart_item_data['myCustomData'] ); } return $other_data; } function custom_add_to_var_cart_product( $cart_item_data, $product_id ) { $cart_item_data['myCustomData'] = 'someCustomValue'; if ( empty( $cart_item_data['options'] ) ) { $cart_item_data['options'] = array(); } return $cart_item_data; }
MyCustomData is no longer displayed in the cart because it’s not stored in $cart_item_data variable in woocommerce_get_item_data filter
i tested it in previous version and it’s OK.
Do you know what is the problem ?
Thanks
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom cart item data not stored in last version’ is closed to new replies.