Order
Order represents an object of a placed order.
List of available attributes
- addresses_equal?
- billing_address
- cart_rules_applied
- code
- completed_at
- currency
- customer
- custom_fields
- discount
- effective_discount_amount
- effective_discount?
- gateway_code
- gateway_name
- gateway_transaction_id
- issued_date
- items
- item_amounts
- items_original_amount
- items_subtotal_amount
- items_tax_amount
- note
- paid?
- paid_at
- payment_method
- payment_status
- shipping_address
- shipping_method
- shipping_original_amount
- shipping_status
- shipping_subtotal_amount
- shipping_tax_amount
- shipping_tax_rate
- status
- tax_amounts
- total_amount
- uuid
- value_date
addresses_equal?
Returns "true" if billing and shipping addresses are the same. Returns "false" otherwise.billing_address
Returns an Address object of the order's billing address.cart_rules_applied
Returns "true" if a discount is applied, otherwise returns "false".
code
Returns order code.
completed_at
Returns date when the order was completed.
currency
Returns order currency as a 3-digit code (e.g. EUR).
customer
Returns a Customer object.custom_fields
Returns an array with custom fields information, containing the following:- kind - type of custom field
- label - the label of the custom field
- value - inserted value
- formatted_value - a formatted version of the custom_field information
{%- for field in order.custom_fields -%}
{{ field.last.label }} — {{ field.last.formatted_value }}
{%- endfor -%}
discount
Returns a Discount object.effective_discount_amount
Returns discount amount.
effective_discount?
Returns "true" if a discount or any cart rule is applied. Otherwise returns "false".
gateway_code
Returns payment gateway code.
gateway_name
Returns payment gateway human readable name.
gateway_transaction_id
Returns payment gateway transaction ID.
issued_date
Returns date when the order was issued.
item_amounts
Returns an array of ordered item totals based on tax_rate. Each element contains the following for ordered items:
- subtotal_amount
- original_amount
- tax_rate
- tax_amount
- total_amount
{%- for item in order.item_amounts -%}
{{ item.tax_rate }}
{%- endfor -%}
items
Returns array of Order item objects of ordered items.items_original_amount
Returns total cost of the order before any discounts.
items_subtotal_amount
Returns total cost of order after applying discounts.
items_tax_amount
Returns tax amount for items.
note
Returns the order note.
paid?
Returns "true" if the order is paid, otherwise returns "false". Sets payment_status value.paid_at
Returns date when the order was paid for.
payment_method
Returns payment gateway method code (e.g. "offline", "swed").
payment_status
Returns payment status – one of "unpaid", "paid", "pending", "cancelled".
shipping_address
Returns an Address object of provided shipping address.shipping_method
Returns a Shipping method object of shipping method.shipping_original_amount
Returns shipping costs before any discounts.
shipping_status
Returns shipping status – either "not_dispatched" or "dispatched".
shipping_subtotal_amount
Returns cost of shipping after applying discounts.
shipping_tax_amount
Returns tax amount for shipping costs.
shipping_tax_rate
Returns the tax rate for shipping costs.
status
Returns general order status – one of "created", "cancelled", "archived".
tax_amounts
Returns the following for order (over line items and shipping) with different tax rates:
- subtotal_amount
- tax_rate
- tax_amount
{% for rate_amounts in order.tax_amounts %}
{% assign tax_rate_int = rate_amounts.tax_rate | floor %}
{% if tax_rate_int == rate_amounts.tax_rate %}
{{ tax_rate_int }}%
{% else %}
{{ rate_amounts.tax_rate }}%
{% endif %}:
{{ rate_amounts.tax_amount | money_with_currency: order.currency }}
{% endfor %}
total_amount
Returns total sum (cart + shipping + tax).
uuid
Returns order's unique UUID.
value_date
Returns date when order is supposed to be paid for.