I'm trying to update a purchasableId against a line item (eg if the variant changes) via a custom module/controller (long story short native controller is not updating options stored against against the line item since upgrading to Craft 3).

If I look at the record in the database the purchasableId is updated but the value in the snapshot does not. On a second save it is.

The cart object references the version in the snapshot - how do I update the snapshot as part of my code so that the cart object shows the correct/intended value?


$lineItem->purchasableId = $purchasableId;
Commerce::getInstance()->getLineItems()->saveLineItem($lineItem, false);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.