# Coupon

## Examples

### Default

By default, this component will be hidden when the cart is empty

```html
<div data-coupon></div>
```

```javascript
render('[data-coupon]', CouponUI);
```

<div class="example">
    <div data-coupon></div>
</div>

### Show even if cart is empty

```html
<div data-coupon='{"show": true}'></div>
```

```javascript
render('[data-coupon]', CouponUI, { show: true });
```

<div class="example">
    <div data-coupon='{"show": true}'></div>
</div>

### Disabled coupon component

The coupon component can be disabled by passing `enabled: false`.
<br>
This will do the following:

* Add a `disabled` css modifier to the component
* Apply a HTML `disabled`-attribute to `<button>`s, `<inputs>`s and other interactive elements.

```css
/* 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.

```html
<div data-coupon='{"enabled": false, "show": true}'></div>
```

```JavaScript
render('[data-coupon]', CouponUI, { enabled: false, show: true });
```

<div class="example">
    <div data-coupon='{"enabled": false, "show": true}'></div>
</div>