0

How do I make this popup Dynamic so I can change the discount code from the BM instead of changes in ISML?

ISML

<div id="discountPopup" class="hidden">
  <p>Use code <strong>DISCOUNT20</strong> for 20% off!</p>
  <button id="closePopup">Close</button>
</div>

My Javascript is

document.addEventListener('DOMContentLoaded', function() {
  // Show the pop-up
  document.getElementById('discountPopup').classList.remove('hidden');

  // Hide the pop-up when the close button is clicked
  document.getElementById('closePopup').addEventListener('click', function() {
    document.getElementById('discountPopup').classList.add('hidden');
  });
});

1 Answer 1

1

Since last year, there is the possibility of fetching all active promotions, ignoring the coupon requirement:

PromotionMgr.getActiveCustomerPromotions(ignoreCouponCondition : boolean);

Using the above code you can get all possible promotions for the active session, then loop over the promotions to finally get the coupon:

promotion.getCoupons();

If you do not want to do it as dynamically, you can always do a remote include of a controller that renders a Content Asset. That content asset you can manage in the Business Manager.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .