One more question, is there any reason why GetCartItemsCountAsync always returns 0?
Tatarincev Eugeney
@tatarincev
Where did you find this method?
Wim Vergouwe
@WimVergouwe
In CartModuleApi
Tatarincev Eugeney
@tatarincev
Hm, it should returns the Cart.Items.Count() for cart with the passed id
seems your cart is always empty somehow
Wim Vergouwe
@WimVergouwe
Not really, when I immediately get the cart after getting the count ,there is a lineitem with quantity 1 in it
Looking at the implementation of GetCart and GetCartItemsCount, I see that they're not using the same pattern to access the cart, could that be a potential issue?
Tatarincev Eugeney
@tatarincev
Indeed
there is Default response group that doesn't allow to load cart items from DB
Wim Vergouwe
@WimVergouwe
That seems to make sense ;)
It probably would be better to have this method on the repository so that SQL could do the aggregation, right?
Tatarincev Eugeney
@tatarincev
Yes for performance reasones,
Wim Vergouwe
@WimVergouwe
There's a cache in place, that one could also be used?
Might be much simpler...
Tatarincev Eugeney
@tatarincev
But I'm strongly recommend to use GraphQL endpoints instead of REST API for these use cases
like a catalog browsing, and work with shopping cart, there is out-te box many very useful features such as prices, discounts, availability evaluations, cart validations and etc
Wim Vergouwe
@WimVergouwe
I agree, but that would be part of second iteration for me.
How mature is it? Are you running it in production somewhere?
Tatarincev Eugeney
@tatarincev
it hasn't worked on any production yet but on going for some projects
HashtagPush
@HashtagPush_twitter
@tatarincev is it possible to add free product x to the shopping cart automatically when using a coupon code?
Tatarincev Eugeney
@tatarincev
Hi, it is required to write some code on the storefront, you can use the special marketing promotions 'gifts' to declare what a product you want to add to the cart
but also you have to implement the logic for this gift application
because the current storefront version doesn't provide such logic out-the-box