I can update existing cart values:

$item = $quote->getItemById($itemId);

But this only works if the option already exists, e.g. an unchecked checkmark custom option will not be included in the item options when adding the product to cart. I tried adding the options with $item->addOption() but that doesn't work because the option is not included in the $item->getProduct()->getCustomOptions(), and trying to add the custom option there also modifies the actual product instead of just the cart item product.

Is there a way to add an existing custom option to an existing cart item without removing and re-adding the item?

1 Answer 1


Spent 2 days trying to figure this out and of course I find the answer an hour after asking a question:

        $buyRequest = $this->serializer->unserialize($item->getOptionByCode('info_buyRequest')->getValue());
        $buyRequest['options'][$code] = $value;
        $quote->updateItem($itemId, $buyRequest);

Using the $quote->updateItem() method with an updated info_buyRequest pushes the update to the cart product as well.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.