Customer order

From Shopify Wiki

(Redirected from Order variable)
Jump to: navigation, search

The Order variable is only accessible from the Customer variable.

To access orders, you would do:

{{ assign order = customer.recent_order }}

or

{% for order in customer.orders %}
   {{ order.total_price | money }}
{% endfor %}

Contents

order.name

Returns the order name. ie: #1037

order.email

order.order_number

Returns integer representation of the order name. ie: 1037

order.subtotal_price

Use money filter to convert to human readable format.

order.total_price

Use money filter to convert to human readable format.

order.tax_price

Use money filter to convert to human readable format.

order.shipping_price

Use money filter to convert to human readable format.

order.discounts

Array of discounts for an order

{% for discount in order.discounts %}
{{ discount.code }} Discount: {{ discount.savings | money }}
{% endfor %}

order.tax_lines

Array of taxes for an order

{% for tax_line in order.tax_lines %}
Tax ({{ tax_line.title }} {{ tax_line.rate | times: 100 }}%):
{{ tax_line.price | money }}
{% endfor %}

order.shipping_methods

Array of shipping for an order

    {% for shipping_method in order.shipping_methods %}
       Shipping ({{ shipping_method.title }}):
      {{ shipping_method.price | money }}
    {% endfor %}

order.line_items

Array of line items for the order

line_item.title

Name of the line item

line_item.sku

Sku of the line item

line_item.price

Price of line item

line_item.quantity

Quantity of line item

line_item.fulfillment

If line item was fulfilled, a fulfillment object

        {% if line_item.fulfillment %}
          <div class="note">
            Fulfilled {{ line_item.fulfillment.created_at | date: "%b %d" }}
            {% if line_item.fulfillment.tracking_number %}
              <a href="{{ line_item.fulfillment.tracking_url }}">{{ line_item.fulfillment.tracking_company }} #{{ line_item.fulfillment.tracking_number}}</a>
            {% endif %}
          </div>
        {% endif %}
fulfillment.created_at

Fulfillment created at date

fulfillment.tracking_number

Tracking number for fulfillment if it exists

fulfillment.tracking_url

Url for tracking number

fulfillment.tracking_company

Name of fulfillment service

order.created_at

Date order is created at

order.fulfillment_status

Returns fulfillment status of order

order.financial_status

Returns financial status of order (pending, authorized, paid)

order.customer_url

Returns url for order details page for a customer

order.cancelled

Returns true if order was cancelled

order.cancelled_at

Returns the order cancellation date, if it was cancelled

order.cancel_reason

Returns the order cancellation reason, if it was cancelled