Evy context methods
Learn how to interact with Evy offers
getSelectedOffer
This method permits getting the information about the currently selected offer from the component state.
evy.getSelectedOffer(productId);
Syntax
Accepted parameter | Required | Type | Description |
---|---|---|---|
productId | yes | string | The product id to add the selected offer for. |
Return value
Returns the offer object.
addSelectedOffer
Make the offer selected for the given product. You can force an offer using the option offerId
parameter.
evy.addSelectedOffer(productId, offer);
Syntax
Accepted parameter | Required | Type | Description |
---|---|---|---|
productId | yes | string | The product id to add the selected offer for. |
offerId | no | string | The id of the offer |
getAttachedOffers
Retrieves currently attached offers objects from the user session state.
evy.getAttachedOffers();
Return value
Returns an object with productId as key and the value is an object containing two keys;
offer
: the selected offer for the productquantity
: the number of offers. It must reflect the quantity in the cart
cancelAttachedOffer
Allows operators to clear chosen offers for a product following a product removal from cart.
evy.cancelAttachedOffer(productId);
Syntax
Accepted parameter | Required | Type | Description |
---|---|---|---|
productId | yes | string | The product id to add the selected offer for. |
Updated 2 months ago