Closed talha2k closed 1 year ago
Out of the blue i would say: Get the CartItem with the rowId and then merge its existing options
$cartItem =$cart->get($rowId)
$cart->update($rowId, array_merge($cartItem->options, [
...
]))
Thank you! I achieved by doing following:
$cart_item = Cart::get($rowId); $new_option = $cart_item->options->merge(['new_variable' => $new_variable_value]); Cart::update($rowId, ['options' => $new_option]);
Cart::update($rowId, ['options' => ['new_option' => 'XXX']]);
using above line replaces all existing options. is there any way to add a new option to existing rowId?