Expand my Community achievements bar.

Questions involving add-to-cart event for commerce and sensei

Avatar

Level 2

I'm currently trying to fix our sensei magento storefront events that use @adobe/aem-core-cif-react-components.

 

We were told to follow the schemas in commerce-events github below.

https://github.com/adobe/commerce-events/blob/main/examples/events/add-to-cart.md

 

I'm implementing a custom useAddToCartEvent that doesn't really deviate from their cif core react component and cif core components. I've noticed that the current version of @adobe/aem-core-cif-react-components does not include all of the necessary fields to set the context of the shopping cart and publish the add to cart event. 

 

Link to the current version of useAddToCartEvent.js.

https://github.com/adobe/aem-core-cif-components/blob/master/react-components/src/talons/Cart/useAdd...

 

We were told that we are missing the topLevelSku and a few other fields. I noticed that in their version, the fields that are required in the schemas are not there. 

The cart item id is missing and I'm not quite sure what to put for it. The examples are pretty plain and do not go in depth on the actual implementation. 

Do I ignore the cart item id, or do I need to set it to the product id or sku?

 

I also had a question about what to set in the shopping cart context. In their version, they pass only the item being added into the shopping cart context before mse.publish.addToCart(). Is this the correct way to do it? 

Here's the file that sends the items added to cart which is the items useAddToCartEvent reads. Even in the updated version 3 it doesn't handle all of the required fields.
https://github.com/adobe/aem-core-cif-components/blob/master/ui.apps/src/main/content/jcr_root/apps/...

 

I would really appreciate a full audit of the repository because it seems to be significantly out of date with the current requirements. 

 

Thank you.

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies