Skip to content

Commit

Permalink
Merge pull request #404 from bitdefender/exitpopup-datasets
Browse files Browse the repository at this point in the history
Adding datasets on exitpopup button
  • Loading branch information
enake authored Nov 19, 2024
2 parents 34aee06 + 859c6f2 commit 158ebb4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions _src/blocks/exit-popup/exit-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ export default async function decorate(block) {
// eslint-disable-next-line no-undef
const products = await Store.getProducts([new ProductInfo(alias, 'consumer', custompid)]);
const productItem = products[alias];
const productCurrency = productItem.currency;
const productRegionId = productItem.regionId;
const variation = productItem.getOption(Number(devices), Number(years));
const percentPrice = variation.getDiscount('percentage');
const newPrice = variation.priceDiscounted;
const oldPrice = variation.price;

// discount in the title
const tileDiscountEl = block.querySelector('h5');
Expand All @@ -21,6 +25,12 @@ export default async function decorate(block) {
if (buyBtnEl) {
buyBtnEl.textContent = buyBtnEl.textContent.replace('50%', `${percentPrice}%`);
buyBtnEl.setAttribute('href', await variation.getStoreUrl());
buyBtnEl.setAttribute('data-product', alias);
buyBtnEl.setAttribute('data-buy-price', newPrice);
buyBtnEl.setAttribute('data-old-price', oldPrice);
buyBtnEl.setAttribute('data-currency', productCurrency);
buyBtnEl.setAttribute('data-region', productRegionId);
buyBtnEl.setAttribute('data-variation', `${devices}u-${years}y`);
}
}

Expand Down

0 comments on commit 158ebb4

Please sign in to comment.