Liquid Template Variables - shop
From Spiffy Stores Knowledge Base
The Liquid template variable shop has the following attributes:
Contents
- 1 shop.id
- 2 shop.name
- 3 shop.description
- 4 shop.owner
- 5 shop.currency
- 6 shop.currency_name
- 7 shop.country
- 8 shop.country_iso
- 9 shop.tax_number
- 10 shop.url
- 11 shop.domain
- 12 shop.permanent_domain
- 13 shop.products
- 14 shop.products_count
- 15 shop.collections
- 16 shop.collections_count
- 17 shop.all_collections
- 18 shop.money_with_currency_format
- 19 shop.money_format
- 20 shop.currency_codes
- 21 shop.currency_options
- 22 shop.types
- 23 shop.vendors
- 24 shop.enabled_payment_types
- 25 shop.customer_accounts_enabled
- 26 shop.customer_accounts_optional
- 27 shop.metafields
- 28 Further Reference
shop.id
Returns the unique internal store id number.
This is normally only for internal usage.
shop.name
Returns a string with the store's name.
Example usage:
{{ shop.name }}
shop.description
Returns a string with the store's description. This value can be configured on the "General Settings" page, under the "Preferences" tab.
If your theme includes the standard headers as follows, then this description will automatically appear in the header tags of your home page.
{% include 'headers' %}
You may use this variable to build a meta description tag for your home page manually if you prefer.
Example usage:
{% if template == 'index' and shop.description != '' %} <meta name="description" content="{{ shop.description }}" /> {% endif %}
shop.owner
Returns a string with the name of the store's owner.
Example usage:
Dear {{ shop.owner }}, you have received a new order!
shop.currency
Returns a string with the name of the currency that this store uses. This is usually a three character representation (e.g. AUD).
Example usage:
All prices are in {{ shop.currency }}
shop.currency_name
Returns a string containing the full descriptive name of the store's currency.
For example
Australian Dollar (AUD)
shop.country
Returns the printable name of the country in which the store is located.
This store is located in {{ shop.country }}
shop.country_iso
Returns the two character ISO country code for the store.
{% if shop.country_iso == 'AU' %}GST is applicable to this store{% endif %}
shop.tax_number
Returns the taxation number for the store, if required by local legislation.
This is usually an ABN (Australia), GST Number (New Zealand) or VAT Registration (Europe).
TAX INVOICE {{ shop.tax_number }}
shop.url
Returns the full URL for your store.
Note: The value depends upon the primary address configured under Preferences -> DNS & Domains.
shop.domain
Returns the domain of your store.
Note: The value depends upon the primary address configured under Preferences -> DNS & Domains.
shop.permanent_domain
Returns the .spiffystores.com domain name of your store.
shop.products
Returns all the products in the store.
shop.products_count
Returns the number of products in the store.
Example usage:
{{ shop.products_count }} {{ shop.products_count | pluralize: 'product', 'products' }} are available
shop.collections
Returns all the collections in the store.
shop.collections_count
Returns the number of collections in the store.
shop.all_collections
Returns all of the store's collections without pagination.
shop.money_with_currency_format
Return the currency formatting string which includes the currency symbol.
shop.money_format
Return the currency formatting string excluding the currency symbol.
shop.currency_codes
Return an array of currency codes that are supported for this store.
The currency codes are determined by the list of countries that have been added in the "Preferences -> Regions & taxes" section of your Toolbox.
<select> {% for c in shop.currency_codes %} <option value="{{ c }}"{% if currency == c %} selected="selected"{% endif %}>{{ c }}</option> {% endfor %} </select>
shop.currency_options
Returns a pre-formatted set of HTML option tags, including the full name of the currency, which can be used within select tags.
The currency codes are determined by the list of countries that have been added in the "Preferences -> Regions & taxes" section of your Toolbox.
Here is an example of the options that are returned:
<option value="AUD">Australian Dollar (AUD)</option> <option value="NZD">New Zealand Dollar (NZD)</option> <option value="USD">United States Dollar (USD)</option> <option value="EUR" selected="selected">Euro (EUR)</option> <option value="GBP">British Pound (GBP)</option> <option value="CAD">Canadian Dollar (CAD)</option>
These options can be used as follows:
<select> {{ shop.currency_options }} </select>
shop.types
Returns a list of all unique product types in the store. An array of types is returned.
Example usage:
<ul> {% for product_type in shop.types %} <li> {{ product_type | link_to_type }} </li> {% endfor %} </ul>
shop.vendors
Returns a list of all unique product vendors in the store. An array of vendors is returned.
Example usage:
<ul> {% for product_vendor in shop.vendors %} <li> {{ product_vendor | link_to_vendor }} </li> {% endfor %} </ul>
shop.enabled_payment_types
Returns an array of credit card names that are currently enabled for the store. Use the payment_type_img_url filter to return a link to the SVG image file for the credit card.
The possible values for this array are -
- visa
- master
- american_express
- paypal
- jcb
- diners_club
- maestro
- discover
- solo
- switch
- laser
- dankort
- forbrugsforeningen
- dwolla
{% for type in shop.enabled_payment_types %} <img src="{{ type | payment_type_img_url }}" width="80" /> {% endfor %}
shop.customer_accounts_enabled
Return true if customer accounts have been enabled in this store.
{% if shop.customer_accounts_enabled %} <li> {% if customer %} <a href="/account">Your Account</a> {% else %} {{ 'Log in' | customer_login_link }} {% if shop.customer_accounts_optional %} <span class="or">or</span> {{ 'Create an account' | customer_register_link }} {% endif %} {% endif %} </li> {% endif %}
shop.customer_accounts_optional
Return true if customer accounts are enabled and are optional in this store.
See previous example for usage.
shop.metafields
Return the metafields for the shop.
Metafields can only be managed using the Spiffy Stores API.