Order

From Shopify Wiki

Jump to: navigation, search

Many properties of an order are available directly through Liquid in various templates.

Note: Unlike most other Liquid objects, the order object itself is not referenced by name in any of the templates which currently use it. So instead of using {{ order.shipping_method }} in your Order Confirmation email template, you would simply use {{ shipping_method }}.

The properties of an order are available in the following templates:


Contents

Order Properties

id

A system wide unique ID of the order for internal use. Use this e.g. to generate a link to the order in the admin section of your shop.

order_name

Name order. Typically this is a pound symbol followed by the order_number. e.g. Order #1004

order_number

Shop unique number of the order. e.g. 1004

created_at

The date and time the customer created the order, e.g. 2009-05-30T17:43:51+02:00

credit_card

The type of credit card used, e.g. Visa or American Express (empty when the order hasn't been payed with credit card) Image:New.gif

customer

Customer object containing the email and name of the client.

customer.email

Email of the customer

customer.name

Name of the customer

shop_name

Name of your shop

subtotal_price

Subtotal of the order

total_price

Total of the order ( subtotal + tax + shipping )

tax_price

Taxes of all the items in the order combined

gateway

Payment method (Payment gateway used)

shipping_method

ShippingMethod object

shipping_price

Shipping price

shipping_address

Shipping Address object

billing_address

Billing Address object

line_items

Array of all Line Items in the order.

fulfilled_line_items

Array of any Line Items which have been fulfilled (marked as shipped on the order screen).

unfulfilled_line_items

Array of those Line Items which have not yet been fulfilled (marked as shipped on the order screen).

note

The note which is attached to the order. The note can be obtained from the customer and/or edited in the order detail screen in your admin interface.

attributes

Any note attributes which were attached to the order.

Example: {{attributes.gift-note}}

referring_site

Contains the url of the referrer that brought the customer to your store

Example: http://www.google.com/?s=great+products


landing_site

Contains the path of the landing site the customer used. This is the first page that the customer saw when he/she reached the store.

Example: /products/great-product?ref=my-tracking-token


landing_site_ref

Looks at the landing site and extracts a reference parameter from it. Reference parameters are:

  • ref
  • source
  • r
Example: 
  
  order.landing_site was /products/great-product?ref=my-tracking-token
  order.landing_site_ref will be my-tracking-token

Discounts in email templates

In all email templates (and only there) you also have access to the following three discount variables:

discounts

Array of discounts applied to the order (currently can be only a single discount, but maybe multiple in the future)

You can retrieve the discount object from the Array with e.g. {% assign discount = discounts[0] %} or with the usual for-loop: {% for discount in discounts %} ... {% endfor %}.

The discount itself has the following Liquid variables:

id

The internal id of that particular discount

title

The name of this discount

code

The code the customer has to input to apply for this discount

amount

Amount of the savings this discount causes (usually same as discounts_amount, because there is only one discount object)

savings

Amount of the discount this discount applies (usually same as discounts_savings, because there is only one discount object)

discounts_amount

Amount of the discount applied by all discounts (e.g. +$5.00)

discounts_savings

Amount of the savings caused by all discounts (e.g. -$5.00)

Personal tools