Checkout
The checkout object has the following attributes:
In this article
- checkout.applied_gift_cards
- checkout.attributes
- checkout.billing_address
- checkout.buyer_accepts_marketing
- checkout.discounts
- checkout.discounts_amount
- checkout.discounts_savings
- checkout.email
- checkout.gift_cards_amount
- checkout.id
- checkout.line_items
- checkout.name
- checkout.note
- checkout.order
- checkout.order_id
- checkout.order_name
- checkout.order_number
- checkout.requires_shipping
- checkout.shipping_address
- checkout.shipping_method
- checkout.shipping_methods
- checkout.shipping_price
- checkout.subtotal_price
- checkout.tax_lines
- checkout.tax_price
- checkout.total_price
- checkout.transactions
- Deprecated properties
checkout.applied_gift_cards
Returns the gift cards applied to the checkout.
checkout.attributes
Returns the attributes of the checkout, that were captured in the cart.
checkout.billing_address
Returns the billing address of the checkout.
checkout.buyer_accepts_marketing
Returns whether the buyer accepted the newsletter during the checkout.
Input
{% if checkout.buyer_accepts_marketing %}
Thank you for subscribing to our newsletter. You will receive our exclusive newsletter deals!
{% endif %}
Output
Thank you for subscribing to our newsletter. You will receive our exclusive newsletter deals!
checkout.discounts
Returns the discounts applied to the checkout.
Input
{% for discount in checkout.discounts %}
* {{ discount.code }}: {{ discount.amount | money }}
{% endfor %}
Output
* secret-discount: 200.000đ
checkout.discounts_amount
Returns the sum of the amount of the discounts applied to the checkout. Use one of the money filters to return the value in a monetary format.
Input
You save: {{ checkout.discounts_amount | money }} <br>
Output
You save: 200.000đ
checkout.discounts_savings
Returns the sum of the savings of the discounts applied to the checkout. The negative opposite of discounts_amount. Use one of the money filters to return the value in a monetary format.
checkout.email
Returns the email used during the checkout.
checkout.gift_cards_amount
Returns the amount paid in gift cards of the checkout. Use one of the money filters to return the value in a monetary format.
checkout.id
Returns the id of the checkout.
checkout.line_items
Returns all the line items of the checkout.
checkout.name
Returns the name of the checkout. This value is identical to checkout.id
with a hash prepended to it.
checkout.note
Returns the note of the checkout.
checkout.order
Returns the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page and this property could be nil.
checkout.order_id
Returns the id of the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page.
checkout.order_name
Returns the name of the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page.
checkout.order_number
Returns the number of the order created by the checkout. Depending on the payment gateway, the order might not have been created yet on the checkout order status page.
checkout.requires_shipping
Returns whether the checkout as a whole requires shipping, that is whether any of the line items require shipping.
Input
{% if checkout.requires_shipping %}
You will receive an email with your shipment tracking number as soon as your order is shipped.
{% endif %}
Output
You will receive an email with your shipment tracking number as soon as your order is shipped.
checkout.shipping_address
Returns the shipping address of the checkout.
checkout.shipping_method
Returns the shipping method of the checkout.
checkout.shipping_methods
Returns an array of shipping methods of the checkout.
Input
Shipping methods: <br>
{% for shipping_method in checkout.shipping_methods %}
* {{ shipping_method.title }}: {{ shipping_method.price | money }} <br>
{% endfor %}
Output
Shipping methods: <br>
* International Shipping: 200.000đ
checkout.shipping_price
Returns the shipping price of the checkout. Use one of the money filters to return the value in a monetary format.
checkout.subtotal_price
Returns the sum of the the cart's line-item prices after any line-item discount or cart discount has been deducted. The subtotal doesn't include taxes (unless taxes are included in the prices) or shipping costs.
Input
subtotal = total dollar value of cart items - line-item discount - cart discount
Subtotal: {{ checkout.subtotal_price | money }}
Output
for a cart containing a $500 product with a $50 cart discount
Subtotal: 500.000đ
checkout.tax_lines
Returns all the tax lines of the checkout.
checkout.tax_price
Returns the tax price of the checkout, whether the taxes are included or not in the prices. Use one of the money filters to return the value in a monetary format.
checkout.total_price
Returns the total price of the checkout. Use one of the money filters to return the value in a monetary format.
Input
Total = subtotal + shipping cost - shipping discount + taxes
Total: {{ checkout.total_price | money }}
Output
For a $500 product with a $50 discount, $10 shipping, and a tax rate of 20%
Total: $552.00
checkout.transactions
Returns an array of from the checkout.
Deprecated properties
Note
The following properties have been deprecated in favour of checkout.order.checkout.unavailable_line_items
Returns the unavailable line items of the checkout. Deprecated because always empty.
checkout.fulfilled_line_items
Returns the fulfilled line items of the checkout. Deprecated because always empty.
checkout.unfulfilled_line_items
Returns the unfulfilled line items of the checkout. Deprecated because always equal to line_items
.
</p>
checkout.fulfillment_status
Returns the fulfillment status of the checkout. Deprecated because always returns 'unfulfilled'.
checkout.financial_status
Returns the financial status of the checkout. Deprecated because always returns nil.
checkout.fulfilled_at
Returns the date of fulfillment of the checkout. Deprecated because always returns nil.
checkout.discount
Returns the discount applied to the checkout but not saved. Deprecated because on the order status page, an unsaved discount would not exist.
checkout.cancelled
Returns whether the checkout is cancelled. Deprecated because always returns false.