0

When Trying to add a sellable item to a cart I get a "item is not purchasable" error, despite the sellable item existing and have a price card with the default currency along with being published.

Here is the error I get in the log:

    00062 13:46:01 INFO Successfully validated the token.
00062 13:46:01 INFO Route matched with "{action = \"AddCartLine\", controller = \"Commands\"}". Executing action "Sitecore.Commerce.Plugin.Carts.CommandsController.AddCartLine (Sitecore.Commerce.Plugin.Carts)"
00062 13:46:01 INFO Authorization was successful.
00071 13:46:01 INFO Executing action method "Sitecore.Commerce.Plugin.Carts.CommandsController.AddCartLine (Sitecore.Commerce.Plugin.Carts)" with arguments (["System.Web.Http.OData.ODataActionParameters"]) - Validation state: Valid
00044 13:46:02 ERROR Inventory.block.PopulateItemAvailability-No ProductArgument in Context
00044 13:46:02 ERROR Availability.PopulateDefaultItemAvailabilityComponentBlock.Catalog..NotFoundInCommerceContext
00044 13:46:02 INFO Inventory.block.PopulateItemAvailability.NotAvailable.|test|test1
00044 13:46:02 ERROR CtxMsg.Error.LineIsNotPurchasable: Text=Item 'test' is not purchasable.
00071 13:46:02 ERROR PipelineAbort:Item 'test' is not purchasable.
00071 13:46:02 INFO Executed action method "Sitecore.Commerce.Plugin.Carts.CommandsController.AddCartLine (Sitecore.Commerce.Plugin.Carts)", returned result "Microsoft.AspNetCore.Mvc.ObjectResult" in 261.4408ms.
00071 13:46:02 INFO Executing ObjectResult, writing value of type '"Sitecore.Commerce.Plugin.Carts.AddCartLineCommand"'.
00044 13:46:02 INFO Executed action "Sitecore.Commerce.Plugin.Carts.CommandsController.AddCartLine (Sitecore.Commerce.Plugin.Carts)" in 284.9628ms
00044 13:46:02 INFO Request finished in 316.2054ms 200 application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8

Interestingly even though I have defined a listing price in the commerce web control panel it doesn't show up in the sellable item model when queried.

Sellable Item model:

{
        "CompositeKey": null,
        "CreatedBy": "sitecore\\Admin",
        "UpdatedBy": "sitecore\\Admin",
        "DateCreated": "2021-02-12T10:09:20.3714064Z",
        "DateUpdated": "2021-02-12T11:54:15.8641275Z",
        "DisplayName": "test",
        "FriendlyId": "test",
        "Id": "Entity-SellableItem-test",
        "Version": 16,
        "EntityVersion": 1,
        "Published": true,
        "IsPersisted": true,
        "Name": "test",
        "Policies": [
            {
                "@odata.type": "#Sitecore.Commerce.Plugin.Pricing.ListPricingPolicy",
                "PolicyId": "a8918f71a4ab40738460f770feb7a50a",
                "Models": [],
                "Prices": [
                    {
                        "CurrencyCode": "DKK",
                        "Amount": 10.0
                    },
                    {
                        "CurrencyCode": "EUR",
                        "Amount": 20.0
                    }
                ]
            },
            {
                "@odata.type": "#Sitecore.Commerce.Plugin.Pricing.PriceCardPolicy",
                "PolicyId": "3f8a788ab25c4e07aa03a1b2edfb6749",
                "Models": [],
                "PriceCardName": "test"
            }
        ],
        "SitecoreId": "6b5bb8ab-7412-54df-204d-4a985443955a",
        "CatalogToEntityList": null,
        "ParentCatalogList": "74330820-a483-34df-c2b0-3d911275667c",
        "ParentCategoryList": "cf134f87-2a37-3bcc-0512-6cfc3bc1690a",
        "ChildrenCategoryList": null,
        "ChildrenSellableItemList": null,
        "ItemVariations": "test1",
        "IsBundle": false,
        "Description": "test",
        "ProductId": "test",
        "Brand": "test",
        "Manufacturer": "test",
        "TypeOfGood": "test",
        "Tags": [],
        "ListPrice": null
    }

I'm unsure how to proceed with my debugging/understanding the problem, any help is gladly appreciated.

4
  • The SellableItem has a PurchaseOptionMoneyPolicy which indicates that the item can be sold in the context currency and represents what the item would actually sell for. Check whether item has a List Price in USD (or currency in default storefront and shop currency). After adding the List Price, you should be able to add the item to the cart! – Sreekrishnan Feb 12 at 14:38
  • Also according to error message, productArgument is null inside PopulateItemAvailability, that mean that product "test" is not found. – Akash S Feb 12 at 14:53
  • @Sreekrishnan thank you for the comment, According to the commerce web controlpanel the item have 2 list prices, one of which is in the default currency. However I have noticed that the ListPrice in the json returned from get sellable items shows null as I have posted in the original post. I guess I need to resolve this issue first. – Benjamin Feb 12 at 16:01
  • @AkashS thank you for your comment, I'm not sure why Availability block says that there is no product as I have shown that the sellable item model does get returned when requested through API. I'm also fairly certain that I have correctly hooked up a positive quantity in the inventory to this sellable item. – Benjamin Feb 12 at 16:04

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.