We created a support ticket with Sitecore: When adding a sellable item (Product) to a cart, the Sitecore Commerce Engine will throw an error if the product's 'FriendlyId' is not the same as the 'ProductId' that is in the Sellable Item Entity JSON. We desired these to be different values. For example, we would like to have the following:
FriendlyId = "0000118"
ProductId = "20030_0000118"
If we do not make the FriendlyId = "20030_0000118", then commerce engine cannot find the product's availability when we are trying to add it to the cart. This happens when we call the 'AddCartLine' method
Here is the error message from the Log:
31 15:57:38 ERROR Inventory.block.PopulateItemAvailability-No ProductArgument in Context
31 15:57:38 ERROR CtxMsg.Error.EntityNotFound: Text=Entity '|0000118|00889918331075' was not found.
31 15:57:38 ERROR PipelineAbort:Entity '|0000118|00889918331075' was not found.
31 15:57:38 ERROR Availability.PopulateDefaultItemAvailabilityComponentBlock.InventoryItemNotFound.|0000118|00889918331075
50 15:57:38 WARN CtxMsg.Warning.EntityNotFound: Text=EntityBzees-20023_0000118 was not found.
12 15:57:38 WARN CtxMsg.Warning.EntityNotFound: Text=EntityBzees-20023_0000118 was not found.
14 15:57:38 ERROR Inventory.block.PopulateItemAvailability-No ProductArgument in Context
12 15:57:38 ERROR CtxMsg.Error.EntityNotFound: Text=Entity '|0000118|00889918331075' was not found.
50 15:57:38 ERROR PipelineAbort:Entity '|0000118|00889918331075' was not found.
50 15:57:38 ERROR Availability.PopulateDefaultItemAvailabilityComponentBlock.InventoryItemNotFound.|0000118|00889918331075
We we notified by Sitecore that it turns out this is a bug. This is a partial response we received on our Sitecore support ticket:
"After checking with developers, there is no requirement for the ProductId and FriendlyId to have the same value. Unfortunately due the current implementation of the product, having different values between the FriendlyId and ProductId will cause other unexpected issues such as the one you are experiencing (Not only for AddCartLine).
Therefore, the behavior you reported was registered as a bug in our bug tracking system in order to have a more consistent use of these values throughout the engine. Thank you for reporting the problem."