Coupon
Examples
Default
By default, this component will be hidden when the cart is empty
<div data-coupon></div>
render('[data-coupon]', CouponUI);
Show even if cart is empty
<div data-coupon='{"show": true}'></div>
render('[data-coupon]', CouponUI, { show: true });
Disabled coupon component
The coupon component can be disabled by passing enabled: false.
This will do the following:
- Add a
disabledcss modifier to the component - Apply a HTML
disabled-attribute to<button>s,<inputs>s and other interactive elements.
/* Example css */
.coupon--disabled { opacity: .5 }
input:disabled { background-color: transparent }
button:disabled { display: none }
You may want to disable the component on a checkout page after the order has been processed.
<div data-coupon='{"enabled": false, "show": true}'></div>
render('[data-coupon]', CouponUI, { enabled: false, show: true });