Cart offer
This widget is designed to be used in a cart page. It displays the attached offer if there is one; otherwise, it displays a button that shows a Modal offer component.
Component display
When there is no offer attached to the product

The modal display after triggering the button

When an offer is selected and the “Add protection” button is clicked, the offer becomes attached to the specified product. The modal is closed.
When an offer is selected

Constructor
The Evy.components.cartOffer
factory creates new instances of the components. The instances should be then passed to the evy
context object using the addComponents
method.
The factory takes parameters using an object with the following keys.
Parameter | Type | Description |
---|---|---|
product | {productId: string, categoryId: string, price: number} | The product description |
container | string | The CSS selector indicating where to insert the component |
displayLegalText | boolean? | Allows to hide the legal text attached to the component |
Warning: it is recommended to keep the legal text underneath the component to conform with the law.
Example
const cartOffer = Evy.components.cartOffer({
product: { productId: 'ME24712745', categoryId: '123', price: 5000 },
container: 'div:nth-child(3) > div',
});
evy.addComponents([cartOffer]);
Updated 12 days ago