nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.08k stars 5.19k forks source link

Discounts caching issue for discounts with start-end datetime, discount not getting applied on defined time #7247

Closed ksbhadani closed 2 weeks ago

ksbhadani commented 2 weeks ago

nopCommerce version: 4.5+

Steps to reproduce the problem: Create a discount (applied to category/manufactured) with start date - 3pm, end date - 4pm, when customers hit the category/product page at between 3pm to 4pm they did not see any discount, discount did not apply even after updating products to clear price cache, also same issue will happen if price cache is disabled

Problem is discounts are cached with start-end datetime filter, I think need to cache all discounts or 'showHidden' parameter should true by default, refer below code snippet

image

AndreiMaz commented 2 weeks ago

@ksbhadani All discounts are cached. And other parameters are filtered later (in memory).

Please see the hint of the "Start date" and "End date" inputs - "The start of the discount period in Coordinated Universal Time (UTC)." Do you enter them in UTC?

ksbhadani commented 2 weeks ago

@AndreiMaz Yes I am aware that those are UTC dates, if you check the code discounts are filtered by dates before cache, also date filters are applied in memory after cache. We don't need to apply filters before cache

skoshelev commented 2 weeks ago

Closed #7247