November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Shakti,
Yes, however you will first need to extend your lineitems with a metafield / property to do this do the following:
I have put together some example code that could possibly be used however you will need to test yourself:
https://gist.github.com/paulmcgann/92a9a18ff2ca51061aa9a6729a468f2c
https://gist.github.com/paulmcgann/b1411560893e26be5cac3db4d3a10df1
Hi Shakti
It would probably be most efficient to load the variant by code. The variants are already cached in Commerce. So loading the variant is usually an insignificant operation. Which scenario do you have where you need to know the type of the variant, without loading the actual variant.
If you store the catalog entry type on the line item, you may waste space in the database. And you risk the data integrity (e.g.g if you change a type somewhere else, and don't update it in the carts).
GitHub - vimvq1987/CatalogContentTypeResolver could be a good way to resolve the content type without having to load the content itself
Hello,
Wondering is their any way to find out type of variants added to the cart? ex: cart.GetAllLineItems() returns InMemoryLine item - how do I know what's variant type without loading content item using variant code.
Regards,
SG