I have the following array :::
WC_Cart Object (
[cart_contents] => Array (
[d6f5bb0bbc] => Array (
[product_id] => 14
[variation_id] => 325
[variation] => Array (
[Your Build] => Windows
)
[quantity] => 1
How would I go about replacing ( updating ) [quantity] => 1 to say [quantity] => 3 :::
Any assistance would be appreciated :::
Update >>> More Info. to make things clearer
Below is the hook ( woocommerce_calculate_totals ) I want to access to change values in the printed array above that originates from print_r($this); :::
I'm not sure how to create the function I need to update the value with add_action( 'woocommerce_calculate_totals', 'my_quantity' );
I have worked with arrays & hooks before but this is a bit out of my league :::
// Allow plugins to hook and alter totals before final total is calculated
do_action('woocommerce_calculate_totals', $this);
/**
* Grand Total
*
* Based on discounted product prices, discounted tax, shipping cost + tax, and any discounts to be added after tax (e.g. store credit)
*/
$this->total = apply_filters('woocommerce_calculated_total', number_format( $this->cart_contents_total + $this->tax_total + $this->shipping_tax_total + $this->shipping_total - $this->discount_total, 2, '.', ''), $this);