I override a function from woocommerce like this :
//Declarre custom function
function custom_add_cart_item($cart_item) {
print_r($cart_item);
return $cart_item;
}
When I print $cart_item
, I want to retrieve [price] => 190
(last line)
Array ( [addons] => Array ( [0] => Array ( [name] => Nombre de pension – Simple [value] => 0 [price] => 0 [wc_booking_block_qty_multiplier] => 1 ) [1] => Array ( [name] => Nombre de pension – Demi-pension [value] => 1 [price] => 30 [wc_booking_block_qty_multiplier] => 1 ) [2] => Array ( [name] => Nombre de pension – Complete [value] => 0 [price] => 0 [wc_booking_block_qty_multiplier] => 1 ) [3] => Array ( [name] => Nombre de supplément – Petit-déjeuner [value] => 0 [price] => 0 [wc_booking_block_qty_multiplier] => 1 ) [4] => Array ( [name] => Nombre de supplément – Lit supplémentaire [value] => 0 [price] => 0 [wc_booking_block_qty_multiplier] => 1 ) ) [booking] => Array ( [_year] => 2016 [_month] => 1 [_day] => 30 [_persons] => Array ( ) [_date] => 2016-1-30 [date] => 30 janvier 2016 [_time] => [_qty] => 1 [_duration_unit] => night [_duration] => 1 [duration] => 1 night [_start_date] => 1454112000 [_end_date] => 1454198400 [_all_day] => 0 [_cost] => 80 [_booking_id] => 646 ) [product_id] => 411 [variation_id] => 0 [variation] => Array ( ) [quantity] => 1 [data] => WC_Product_Accommodation_Booking Object ( [availability_rules:WC_Product_Booking:private] => Array ( ) [id] => 411 [post] => WP_Post Object ( [ID] => 411 [post_author] => 1 [post_date] => 2016-01-27 10:55:23 [post_date_gmt] => 2016-01-27 10:55:23 [post_content] => [post_title] => Produit de test [post_excerpt] => [post_status] => publish [comment_status] => open [ping_status] => closed [post_password] => [post_name] => produit-de-test [to_ping] => [pinged] => [post_modified] => 2016-01-27 16:04:41 [post_modified_gmt] => 2016-01-27 16:04:41 [post_content_filtered] => [post_parent] => 0 [guid] => http://xxx.xxx [menu_order] => 0 [post_type] => product [post_mime_type] => [comment_count] => 0 [filter] => raw ) [product_type] => accommodation-booking [shipping_class:protected] => [shipping_class_id:protected] => 0 [total_stock] => [supports:protected] => Array ( ) [wc_booking_duration_type] => customer [wc_booking_duration_unit] => night [wc_booking_duration] => 1 [manage_stock] => no [stock_status] => instock [price] => 110 ) )
Sorry for that ugly array..
I don’t know how to retrive this value. Thanks for your help !