When I originally installed Commerce 9 via SIF, everything worked fine. But since building/deploying the Sitecore.Commerce.Engine
project (sans all sample plugins), adding an item to the cart results in the following error being displayed:
GetCurrentCart: Value cannot be null
Here's there research I've done so far:
The error is being thrown by Sitecore.Commerce.XA.Feature.Cart.Models.JsonResults.CartLineJsonResult.SetLink()
because it fails to lookup the product by the id that's being mapped from the Id
property of the CartProductComponent
that's attached to the CartLineComponent
.
Looking at the raw entity data and the id
attribute is a GUID, but SXA clearly expects it to be a the product id so it makes sense that the index query turns up nothing.
Looking into the blocks in Plugin.Cart
, and AddCartLineBlock
does indeed generate a new guid in scenarios where it's not being merged into an existing cart line.
I can see that PopulateLineItemProductBlock
does exactly what I expect to happen: load the sellable item and populate the CartProductComponent
. However, it's not added to any pipeline's in the Cart (or any other) plugin's ConfigureSitecore class.
I've run into missing plugin issues related to building the Engine project exclusively, so I'm not ruling that out but I can't see the missing piece.