QUANTM7 Docs
QuillObjects

Discount

The discount object for coupons, automatic discounts, and promotional pricing.

The discount object holds a price cut that has been applied to a cart or order. You can read it from cart.discount or from the order.discount_codes array.

Properties

PropertyTypeDescription
discount.idnumberThe unique discount ID
discount.namestringThe discount name set in the admin
discount.codestringThe coupon code (if triggered by code)
discount.amountnumberThe discount value (in the smallest currency unit for fixed amounts, or a percentage)
discount.typestringThe discount type (see below)
discount.target_typestringWhat the discount applies to: order, products, or shipping
discount.savingsnumberThe total savings in the smallest currency unit

Discount types

TypeDescription
pct_off_orderPercentage off the entire order
amount_off_orderFixed amount off the entire order
pct_off_productsPercentage off specific products
amount_off_productsFixed amount off specific products
free_shippingFree shipping
buy_x_get_yBuy X get Y free or discounted
free_giftFree gift with purchase
fixed_bundleFixed price bundle
tiered_spendSpend more, save more
cheapest_freeCheapest item free

Showing applied discounts

On the cart page:

{% if cart.discount %}
  <div class="discount-applied">
    <p>{{ cart.discount.code }}: {{ cart.discount.savings | money }} off</p>
  </div>
{% endif %}

On the order confirmation:

{% for discount in order.discount_codes %}
  <p>
    <span class="discount-code">{{ discount.code }}</span>
    <span class="discount-amount">-{{ discount.amount | money }}</span>
  </p>
{% endfor %}

Conditional content

Show different messaging based on the discount type:

{% if cart.discount %}
  {% case cart.discount.type %}
    {% when 'free_shipping' %}
      <p>Free shipping applied!</p>
    {% when 'pct_off_order' %}
      <p>{{ cart.discount.amount }}% off your order</p>
    {% else %}
      <p>Discount applied: {{ cart.discount.savings | money }} off</p>
  {% endcase %}
{% endif %}

On this page