Automatically apply a coupon or discount to a store - xmpie-users/uStore-js GitHub Wiki

Sometimes you might want to apply a discount to all products in a Store for a limited time. For example, a holiday special.

This JavaScript will automatically apply a coupon code to your store - even if the customer is unaware of the coupon code.

<script type="text/javascript">
$("document").ready(function() {
  if ($("#ctl00_cphMainContent_btnCouponRecalculate").length > 0 && $("#ctl00_cphMainContent_txtCouponCode").val () == "") {
    $("#ctl00_cphMainContent_txtCouponCode").val ("COUPON_CODE_GOES_HERE");
    window.location.href=$("#ctl00_cphMainContent_btnCouponRecalculate").attr ("href");
  }
});
</script>
  • Replace COUPON_CODE_GOES_HERE with the coupon you created for your store.
  • Note that the coupon code you create should be a "Promotion Code" (not a Personal Coupon), and should not be limited to a set number of orders.
  • When the offer expires, you should remove the JavaScript from your store, or customers will be warned that the coupon has expired.

For information on how to add JavaScript to your store: How to add JavaScript to a storefront.

⚠️ **GitHub.com Fallback** ⚠️