• Not Answered

Cart is not calculating automatic promotion for a product in Sitecore commerce 9.

Hi All,

I have a problem with automatic promotion not getting applied in Cart.

I have created an automatic Promotion with 

Condition:
Current Customer Has Purchased [specific] Item?

and 

Action:
Get Cart Item Subtotal [specific] Percent Off

I purchased a product A. Now adding product B in the basket where I should get 10% off because that is dependent on Product A being in my order history. But I can't see any promotion applied on the page. When I see the log I found the there are 2 called to Sitecore engine the first one is  localhost:5000/.../AddCartLine where It seens to have all the promotion available and that is applied to the calcutions (Subtotals) then there is onw more call to the cart  HTTP/1.1 GET localhost:5000/.../Carts and it can't find the promotion because it s ot passing the userID in FindEntitiesInListCommand.Orders-ByCustomer-: Skip=0|Take=2147483647|Count=0|Pages=0

Has anyone come across problem like this? Any help will be appreciated.

here are few entries from log....

INFO Request finished in 8.0491ms 200 application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
17 14:24:56 INFO Request starting HTTP/1.1 POST localhost:5000/.../AddCartLine application/json;odata.metadata=minimal 127
17 14:24:56 INFO Authorization was successful for user: null.
18 14:24:56 INFO Executing action method "Sitecore.Commerce.Plugin.Carts.CommandsController.AddCartLine (Sitecore.Commerce.Plugin.Carts)" with arguments (["System.Web.Http.OData.ODataActionParameters"]) - ModelState is Valid

.

.

19 14:24:56 INFO Promotions.block.SearchForPromotions.LoadPromotions
19 14:24:56 INFO Promotions.block.SearchForPromotions.PromotionsLoaded
19 14:24:56 INFO FindEntitiesInListCommand.Orders-ByCustomer-Entity-Customer-58513d18b6f14f3ab2f66f34c8765f85: Skip=0|Take=2147483647|Count=1|Pages=0
17 14:24:56 INFO FindEntitiesInListCommand.Orders-ByCustomer-Entity-Customer-58513d18b6f14f3ab2f66f34c8765f85: Skip=0|Take=2147483647|Count=1|Pages=0
17 14:24:56 INFO ---------- Custom CalculateShippingPriceBlock 14:24:56:505 promotions

.

.

SQL:block:persistentity.Cart: EntityId=DefaultEntity-Customer-58513d18b6f14f3ab2f66f34c8765f85Brother ES
25 14:24:57 INFO Executing ObjectResult, writing value "Microsoft.AspNetCore.Mvc.ControllerContext".
9 14:24:57 INFO Executed action "Sitecore.Commerce.Plugin.Carts.CommandsController.AddCartLine (Sitecore.Commerce.Plugin.Carts)" in 865.739ms
9 14:24:57 INFO Request finished in 869.8516ms 200 application/json;odata.metadata=minimal; charset=utf-8
19 14:24:57 INFO Request starting HTTP/1.1 GET localhost:5000/.../Carts('DefaultEntity-Customer-58513d18b6f14f3ab2f66f34c8765f85Brother ES')
19 14:24:57 INFO Authorization was successful for user: null.
17 14:24:57 INFO Executing action method "Sitecore.Commerce.Plugin.Carts.CartsController.Get (Sitecore.Commerce.Plugin.Carts)" with arguments (["DefaultEntity-Customer-58513d18b6f14f3ab2f66f34c8765f85Brother ES"]) - ModelState is Valid
19 14:24:57 INFO Inventory.block.PopulateLineItemInventory.ItemAvailabilityComponent.Expired: EffectiveDate=27/06/2019 13:24:57 +00:00|Expires=01/01/0001 00:00:00 +00:00|ItemId=BIE_ES_Master|TN320M_ES|
19 14:24:57 INFO Inventory.block.PopulateLineItemInventory.ComponentUpdated.: Count=0

.

.

19 14:24:57 INFO Promotions.block.SearchForPromotions.LoadPromotions
19 14:24:57 INFO Promotions.block.SearchForPromotions.PromotionsLoaded
19 14:24:57 INFO FindEntitiesInListCommand.Orders-ByCustomer-: Skip=0|Take=2147483647|Count=0|Pages=0
48 14:24:57 INFO FindEntitiesInListCommand.Orders-ByCustomer-: Skip=0|Take=2147483647|Count=0|Pages=0

.

.

19 14:24:57 INFO Executing ObjectResult, writing value "Microsoft.AspNetCore.Mvc.ControllerContext".
12 14:24:57 INFO Executed action "Sitecore.Commerce.Plugin.Carts.CartsController.Get (Sitecore.Commerce.Plugin.Carts)" in 568.6448ms
12 14:24:57 INFO Request finished in 569.4865ms 200 application/json;odata.metadata=minimal; charset=utf-8

 

Thanks,

Kanchan