Discount
Discount represents an object describing a discount.
List of available attributes
- amount
- amount_mode
- applies_to
- applies_to_cart?
- applies_to_categories?
- applies_to_items?
- applies_to_products?
- applies_to_shipping?
- code
- currency
- discount_type
- fixed?
- stackable?
- percentage?
- net_amount_mode?
- gross_amount_mode?
amount
Returns the discount amount. For a percentage discount, this is a percentage; for a fixed discount, it is a monetary amount interpreted according to amount_mode.
amount_mode
Returns whether a fixed discount amount is specified as net or gross. Defaults to net. This setting does not affect percentage discounts.
applies_to
Returns what the discount applies to. Values can be products, categories, cart, shipping or cart_and_shipping.
applies_to_cart?
Returns true if the discount applies to the cart, including when applies_to is cart_and_shipping.
applies_to_categories?
Returns true if the discount applies to categories.
applies_to_items?
Returns true if the discount applies to products or categories.
applies_to_products?
Returns true if the discount applies to products.
applies_to_shipping?
Returns true if the discount applies to shipping, including when applies_to is cart_and_shipping.
code
Returns the discount redemption code.
currency
Returns the discount currency.
discount_type
Returns the discount type: percentage or fixed.
fixed?
Returns true if the discount type is fixed.
stackable?
Returns true if the discount can be combined with product sale prices. When true, the discount is calculated from the sale price instead of the regular price.
percentage?
Returns true if the discount type is percentage.
net_amount_mode?
Returns true if amount_mode is net.
gross_amount_mode?
Returns true if amount_mode is gross.