Skip to content

[amp story shopping] Set active product data in store service #37013

@processprocess

Description

@processprocess

Description

When a shopping-tag is clicked:
Add an 'activeProductData' key to SHOPPING_DATA.
Set the value to the shopping data (ShoppingConfigDataDef) of the clicked item.

Example implementation of a handler in amp-story-shopping-tag:

const shoppingData = this.storeService_.get(StateProperty.SHOPPING_DATA);
this.storeService_.dispatch(Action.ADD_SHOPPING_DATA, {
   'activeProduct': activeProductData[product-tag-id]
});

An alternate option would be to send the productData from the click handler, this would remove the get from the click handler.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions