Difference between revisions of "Liquid Template Variables - gift card"

From Spiffy Stores Knowledge Base

(Created page with "The Liquid template variable '''gift_card''' has the following attributes: == <code>cart.item_count</code> == Returns the number of items currently in the shopping cart. Fo...")
 
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
The Liquid template variable '''gift_card''' has the following attributes:
 
The Liquid template variable '''gift_card''' has the following attributes:
  
== <code>cart.item_count</code> ==
+
== <code>gift_card.balance</code> ==
 +
Returns the amount of money remaining on the gift card.
  
Returns the number of items currently in the shopping cart.
+
For example:
 +
 
 +
<pre>The remaining balance on your gift card is: {{ gift_card.balance | money }}</pre>
 +
 
 +
== <code>gift_card.code</code> ==
 +
Returns the code that was used to redeem the gift card.
  
 
For example:
 
For example:
  
<pre>{% if cart.item_count == 0 %}
+
<pre>The code to redeem the gift card is: {{ gift_card.code }}</pre>
  Your shopping cart is empty!
+
 
{% else %}
+
== <code>gift_card.currency</code> ==
  You have <a href="/cart">{{ cart.item_count }} {{ cart.item_count | pluralize: 'item', 'items' }}</a> in your cart
+
Returns the currency that the card was issued in. This is the store currency.
{% endif %} </pre>
+
 
 +
== <code>gift_card.customer</code> ==
 +
Returns the [[Liquid Template Variables - customer|customer]] variable of the customer that owns the gift card.
 +
<pre>Hi {{ gift_card.customer.first_name }}!</pre>
 +
 
 +
== <code>gift_card.enabled</code> ==
 +
Returns true if the card is enabled, or false if the card is disabled.
 +
== <code>gift_card.expired</code> ==
 +
Returns true if the card has expired, or false if the card is still valid.
 +
 
 +
== <code>gift_card.expires_on</code> ==
 +
Returns the expiration date of the gift card.
 +
 
 +
== <code>gift_card.initial_value</code> ==
 +
Returns the initial amount of money on the gift card. This amount is in the store's currency.
 +
 
 +
== <code>gift_card.last_four_characters</code> ==
 +
Returns the last four characters of the code that is used to redeem the gift card.
 +
 
 +
== <code>gift_card.product</code> ==
 +
Returns the product associated with the purchased gift card, or returns nothing if there is no associated product.
 +
== <code>gift_card.url</code> ==
 +
Returns the unique URL that links to the gift card's page in the checkout (rendered using the ''gift_card.liquid'' template).
  
 
== Further Reference ==
 
== Further Reference ==

Latest revision as of 12:12, 28 January 2022

The Liquid template variable gift_card has the following attributes:

gift_card.balance

Returns the amount of money remaining on the gift card.

For example:

The remaining balance on your gift card is: {{ gift_card.balance | money }}

gift_card.code

Returns the code that was used to redeem the gift card.

For example:

The code to redeem the gift card is: {{ gift_card.code }}

gift_card.currency

Returns the currency that the card was issued in. This is the store currency.

gift_card.customer

Returns the customer variable of the customer that owns the gift card.

Hi {{ gift_card.customer.first_name }}!

gift_card.enabled

Returns true if the card is enabled, or false if the card is disabled.

gift_card.expired

Returns true if the card has expired, or false if the card is still valid.

gift_card.expires_on

Returns the expiration date of the gift card.

gift_card.initial_value

Returns the initial amount of money on the gift card. This amount is in the store's currency.

gift_card.last_four_characters

Returns the last four characters of the code that is used to redeem the gift card.

gift_card.product

Returns the product associated with the purchased gift card, or returns nothing if there is no associated product.

gift_card.url

Returns the unique URL that links to the gift card's page in the checkout (rendered using the gift_card.liquid template).

Further Reference