{"_id":"58112e73ded0340f0085d06d","project":"551e85be610f400d00837db7","version":{"_id":"58112e71ded0340f0085d02a","project":"551e85be610f400d00837db7","__v":4,"createdAt":"2016-10-26T22:30:09.862Z","releaseDate":"2016-10-26T22:30:09.862Z","categories":["58112e72ded0340f0085d02b","58112e72ded0340f0085d02c","58112e72ded0340f0085d02d","58112e72ded0340f0085d02e","58112e72ded0340f0085d02f","58112e72ded0340f0085d030","58112e72ded0340f0085d031","58112e72ded0340f0085d032","58112e72ded0340f0085d033","58112e72ded0340f0085d034","581137cc604d3c230048b7e4","58dc367221742d0f00a73f98","590768e54669da0f00db5c0b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"new designer","version_clean":"2.0.0","version":"2.0"},"user":"551e85707ca3030d00be0c07","category":{"_id":"58112e72ded0340f0085d02c","project":"551e85be610f400d00837db7","__v":0,"version":"58112e71ded0340f0085d02a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-07T18:58:09.521Z","from_sync":false,"order":2,"slug":"theme-logic","title":"Theme Logic & Components"},"parentDoc":null,"__v":0,"updates":["55843be8fb52ee0d0015d1c3","5654ec20648fc80d00bd095b"],"next":{"pages":[],"description":""},"createdAt":"2015-04-07T21:48:03.603Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Customer\"\n}\n[/block]\nThe Customer object represents customer data such as name, email, primary and shipping addresses, and authentication credentials. This object is primarily used in the ``html/customer/account.html`` and ``html/customer/edit.html`` pages.\n\n``customer.created_at`` _The datetime that this Customer object was created_\n\n``customer.custom_data`` _Any metadata attached to this customer_\n\n``customer.email`` _The email address associated with this Customer_\n\n``customer.first_name`` _The first name associated with this Customer_\n\n``customer.last_name`` _The last name associated with this Customer_\n\n``customer.name`` _The full name associated with this Customer_\n\n``customer.calc_primary_address()`` _Returns the primary Address object associated with this Customer_\n\n``customer.calc_ship_address()`` _Returns the shipping Address object associated with this Customer_\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Sub\"\n}\n[/block]\nRepresents the Subscription object. This will carry data such as the renewal date (end_date), start date, and current status. If a subscription is switched to a different product, or a coupon added after checkout, this creates a new *subscription_template* object, so as to preserve the historical data.\n\n``sub.custom_data``\n_Any metadata attached to this subscription_\n\n``sub.status``\n_The status of the subscription. (1=Unpaid, 2=Active, 3=Cancelled, 4=Suspended, 5=Expired, 6=Past Due, 7=Pending Renewal, 8=Renewing, 8=Unpaid Order Failed)_\n\n``sub.start_date``\n_The start date of the subscription_\n\n``sub.end_date``\n_The end (or renewal) date of the subscription_\n\n``sub.current_template``\n_The current subscription template._\n\n\n\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Subscription Template\"\n}\n[/block]\nRepresents the Subscription Template object, a snapshot of a subscription's state. This will carry relations that may change, such as the associated shipping address, product(s), and coupons on a subscription. When these aspects of a subscription are modified, a new subscription template is created, so the historical data is preserved.\n\n``tpl.products``\n_A list of products for the subscription._\n\n``tpl.coupons``\n_A list of coupons on the subscription. This will not include coupons added during checkout, which are cart_coupons rather than subscription coupons._\n\n``tpl.note``\n_A note on what caused the creation of a new template. For example: \"Subscription initialization\", \"Subscription product changed by Jane Doe\", \"Coupon FREEBOX added to subscription renewal #123456789 by John Smith\"_\n\n```tpl.created_at```\n_When the template was created._\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Pay\"\n}\n[/block]\n\nThe Pay object represents a Customer’s payment processing data.\n\n``customer_pay.exp_month``\n_The expiration month of the card for this Pay object_\n\n``customer_pay.exp_year``\n_The expiration year of the card for this Pay object_\n\n``customer_pay.last_four``\n_The last four digits of the card for this Pay object_\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Address\"\n}\n[/block]\nThe Address object represents a Customer’s primary and/or shipping address.\n\n``address.to``\n_The Customer’s recipient line for this Address_\n\n``address.company``\n_The Customer’s company name for this Address_\n\n``address.street``\n_The street address of the Customer’s Address_\n\n``address.unit``\n_The secondary address unit designator of the Customer’s Address_\n\n``address.city``\n_The city field of the Customer’s Address_\n\n``address.state``\n_The state field of the Customer’s Address_\n\n``address.zip_code``\n_The zip code field of the Customer’s Address_\n\n``address.country``\n_The country name of the Customer’s Address_\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Store\"\n}\n[/block]\nThe Store object represents your store. It contains all products, themes, and customers related to your store.\n\n``store.name``\n_The human readable store name_\n\n``store.has_gifting``\n_Boolean, indicates at least 1 product can be bought with coupons_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% if store.has_gifting %}\\n    <a href=\\\"/subscribe/gift/\\\" class=\\\"btn\\\">Give a Gift</a>\\n{% endif %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n# PAGINATION QUERIES\n\n``store.category_products(category)``\n_Return a query products that can be passed to paginate. Filters with taxonomy = category_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% paginate store.category_products(category='helmets') by 4, page %}\\n    {% for product in paged_items %}\\n        {{ my_product_macro(4, product) }}\\n    {% endfor %}\\n{% endpaginate %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n``store.shop_products(category=None, include_hidden=False)``\n_Return query for e-commerce products that can be passed to paginate. You can filter by category = taxonomy, and include hidden products._\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% paginate store.shop_products(category='birds', include_hidden=True) by 4, page %}\\n    {% for product in paged_items %}\\n        {{ my_product_macro(4, product) }}\\n    {% endfor %}\\n{% endpaginate %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n# ITERABLE PRODUCT LISTS\n\nThe following store properties can all be iterated over in the same way, the key difference is what combination of ecommerce/subscription and visible/hidden filters you want to apply.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!-- To iterate over subscription_products -->\\n{% for product in store.subscription_products %}\\n    {{ my_product_macro(product) }}\\n{% endfor %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n``store.products``\n_A list of all Product objects attached to this store_\n\n``store.ecom_products``\n_A list of only e-commerce Product objects attached to this store_\n\n``store.subscription_products``\n_A list of only subscription Product objects attached to this store that are enabled for display._\n\n``store.subscription_only_products``\n_A list of only subscription Product objects attached to this store including both enabled and disabled products._\n\n``store.visible_subscription_products``\n_A list of only visible subscription Product objects attached to this store_\n\n``store.hidden_subscription_products``\n_A list of only hidden subscription Product objects attached to this store_\n\n``store.visible_products``\n_A list of visible Product objects attached to this store_\n\n``store.hidden_products``\n_A list of hidden Product objects attached to this store_\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Product\"\n}\n[/block]\nThe Product object is the main representation of a product. It may have multiple variants, image data, subscription term\n\n## PROPERTIES\n\n``product.name``\n_The human readable product name_\n\n``product.description``\n_The human readable product description_\n\n``product.images``\n_A list of images available for this product_\n\n``product.instances``\n_A list of non-gift ProductInstance objects attached to this product_\n\n``product.giftinstances``\n_A list of gift ProductInstance objects attached to this product_\n\n``product.taxonomy``\n_A list of tags on an ecommerce product_\n\n\n## METHODS\n\n``product.get_term_price(term_name=None)``\n_Returns a TermPrice object, which links a price to a product Instance and a subscription Term. The TermPrice can be found by term_rank (0-numTermsEnabled)._\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<span>{{ product.get_term_price(term_rank=0).price | currency }}</span>\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n``product.get_variant_type_by_name(name)``\n_Returns a VariantType object by name, useful for looping over all variant values by name._\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% set style_variant = product.get_variant_type_by_name('style') %}\\n{% for value in style_variant.values %}\\n<!-- display values -->\\n{% endfor %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n## MINIMUM-MAXIMUM PRICE RANGES\n\nNote: For convenience, you can and should use the get_price_or_price_range filter to avoid calculating ranges in your templates.\n\n``product.calc_min_price(*variant_types, **kwargs)``\n_Returns the minimum possible subscription price for the given variant types and choices._\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% set min = product.calc_min_price(variant, values=chosen_values + [value]) %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n``product.calc_max_price(*variant_types, **kwargs)``\n_Returns the maximum possible subscription price for the given variant types and choices. Useful for displaying price ranges for different variants._\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% set max = product.calc_max_price(variant, values=chosen_values + [value]) %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n``product.calc_min_ecom_price(*variant_types, **kwargs)``\n_Returns the minimum possible ecommerce price for the given variant types and choices. Useful for displaying price ranges for different variants._\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% set min = product.calc_min_ecom_price(variant, values=chosen_values + [value]) %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n``product.calc_max_ecom_price(*variant_types, **kwargs)``\n_Returns the maximum possible subscription price for the given variant types and choices. Useful for displaying price ranges for different variants._\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% set max = product.calc_max_ecom_price(variant, values=chosen_values + [value]) %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Variant Type\"\n}\n[/block]\nThe VariantType object represents a definable type of product option. Some examples would be a product’s Size, Color, or Style.\n\n``variant_type.name``\n_The defined name of the variant type_\n\n``variant_type.description``\n_The defined description of the variant type_\n\n``variant_type.values``\n_A list of available VariantValue objects associated with this VariantType_\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Variant Value\"\n}\n[/block]\nThe VariantValue object represents a definable option for a VariantType. A VariantType of ‘Size’ may have VariantValue objects such as ‘Small’, ‘Medium’, and ‘Large’.\n\n``variant_value.value``\n_The defined value_\n\n``variant_value.is_default``\n_Boolean, whether this VariantValue is the default for its VariantType_\n\n``variant_value.description``\n_The definable description_\n\n``variant_value.images``\n_Associated images for this VariantValue_\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Product Instance\"\n}\n[/block]\nThe ProductInstance object represents a single configuration of a Product and its variant & subscription options\n\n``instance.term_prices``\n_A list of all TermPrice objects associated with this instance_\n\n``instance.calc_num_enabled_terms()``\n_Returns the number of subscription terms enabled for this product instance_\n\n``instance.calc_term_discount(term_price)``\n_Returns the term discount of the passed in TermPrice object. This is the percentage savings of the TermPrice vs the Instance’s single term cycle price, which indicates the savings of buying a multi-cycle term vs a single cycle term._\n\n``instance.sku``\n_The SKU associated with this product instance_\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{% for term_price in instance.term_prices %}\\n    <span>Discount: {{ instance.calc_term_discount(term_price) | currency }}</span>\\n{% endfor %}\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Subscription Term\"\n}\n[/block]\nThe Term object represents a subscription term, which can have 1 or more cycles, depending on your configuration.\n\n``term.name``\n_The name of this term_\n\n``term.enabled``\n_Boolean, whether or not this term is enabled_\n\n``term.description``\n_The description of this term_\n\n``term.num_cycles``\n_The number of cycles for this term_\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Subscription Term Price\"\n}\n[/block]\nThe TermPrice object represents the price for the intersection of an Instance and a Term\n\n``term_price.price``\n_The defined price for this Instance/Term combination_\n\n``term_price.term``\n_The Term object associated to this TermPrice_\n\n``term_price.instance``\n_The Instance object associated to this TermPrice_\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Order\"\n}\n[/block]\nThe order object represents a complete order on the platform and is only created after successful checkout\n\n``order.financial_status``\n_Payment for the order. One of: \"pending\", \"authorized\", \"partial\", \"paid\", \"refunded\", \"voided\"_\n\n``order.fulfillment_status``\n_One of: \"unfilled\", \"partial\", \"fulfilled\"_. (Note: This field is immediately marked fulfilled for subscription orders. It's generally better to look at a shipment status.)\n\n``order.is_renewal``\n_Whether the order was generated automatically from a subscription renewal_\n\n``order.is_test``\n_Whether the order was created while in Test Mode_\n\n``order.note``\n_Optional note on the order added via the merchant portal_\n\n``order.placed_at``\n_The datetime for when this order was placed_\n\n``order.refund_amount``\n_The total refund for all transactions in the Order_\n\n``order.status``\n_Order status: \"open\" or \"closed\"_\n\n``order.total``\n_Grand total cost for order_\n\n``order.total_price``\n_Total before shipping, taxes and fees. Just the cost of product._\n\n``order.transaction_fee``\n_Fee applied by third party payment gateway_\n\n``order.total_shipping``\n_Total price of shipping_\n\n``order.total_tax``\n_Total taxes collected_\n\n``order.id``\n_Order id._\n\n``order.products``\n_List of product_\\__instance objects, excluding gift cards and gifting 1.0 gifts._\n\n``order.gifts``\n_List of product_\\__instance objects, gifting 1.0 gifts only._\n\n``order.fulfillments``\n_List of Fulfillment objects._\n\n``order.subscriptions``\n_List of Subscription objects._\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Settings\"\n}\n[/block]\nThe Settings object represents any theme specific configurable settings that you define, like default theme colors and fonts, Designer configurations, and variables to be made available to Jinja2. Available Settings properties are defined in your theme’s ``config/settings_data.json`` file. Settings values can be accessed in templates as properties of the settings object.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<span>Current Main font choice is: {{ settings.face_main }}</span>\",\n      \"language\": \"jinja2\"\n    }\n  ]\n}\n[/block]\n\n**Output:**\n\n```\nCurrent Main font choice is: Lucida-Sans\n```\n\nThe Settings object is also used in our Designer customizable fonts and colors. You can reference the settings object in your CSS files:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"h2 .heading {\\n    font-family: {{ settings.face_main }};\\n}\",\n      \"language\": \"css\"\n    }\n  ]\n}\n[/block]\n**Output:**\n\n```\nh2 .heading {\n    font-family: Lucida-Sans;\n}\n```\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Cart\"\n}\n[/block]\nThe Cart object represents a customer's cart, which may contain 0 or more products. You may access it on the checkout page simply by referencing `cart`, or on any other page by referencing `active_cart()`.\n``cart.id``\n_The integer id for the cart._\n\n``cart.anon_id``\n_The string id for the cart, used in the URL. Null when customer is logged in._\n\n``cart.custom_data``\n_Any metadata attached to this cart_\n\n``cart.customer_id``\n_Customer id, or null if not logged in._\n\n``cart.store_id``\n_The store id associated with the cart._\n\n``cart.products``\n_List of product_instance objects, excluding Gifting 1.0 gifts._\n\n``cart.gifts``\n_List of product_instance objects. (Gifting 1.0 only.)_\n\n``cart.ship_price``\n_Shipping price. May be null before calculation on checkout page._\n\n``cart.tax_price``\n_Tax price. May be null before calculation on checkout page._\n\n``cart.coupons``\n_A list of coupons on the cart. Note: these are cart_coupon objects, not coupon objects. Each cart_coupon \"c\" will have a coupon referenced by c.coupon_\n\n``cart.gift_cards``\n_A list of cart gift cards on the cart. Note: these are cart_gift_card objects, not gift_card objects. Each cart_giftcard \"c\" will have a gift card referenced by c.card_","excerpt":"These are the types of objects that can be referenced from your theme pages.","slug":"store-object-types","type":"basic","title":"Page Variable Types"}

Page Variable Types

These are the types of objects that can be referenced from your theme pages.

[block:api-header] { "type": "basic", "title": "Customer" } [/block] The Customer object represents customer data such as name, email, primary and shipping addresses, and authentication credentials. This object is primarily used in the ``html/customer/account.html`` and ``html/customer/edit.html`` pages. ``customer.created_at`` _The datetime that this Customer object was created_ ``customer.custom_data`` _Any metadata attached to this customer_ ``customer.email`` _The email address associated with this Customer_ ``customer.first_name`` _The first name associated with this Customer_ ``customer.last_name`` _The last name associated with this Customer_ ``customer.name`` _The full name associated with this Customer_ ``customer.calc_primary_address()`` _Returns the primary Address object associated with this Customer_ ``customer.calc_ship_address()`` _Returns the shipping Address object associated with this Customer_ [block:api-header] { "type": "basic", "title": "Sub" } [/block] Represents the Subscription object. This will carry data such as the renewal date (end_date), start date, and current status. If a subscription is switched to a different product, or a coupon added after checkout, this creates a new *subscription_template* object, so as to preserve the historical data. ``sub.custom_data`` _Any metadata attached to this subscription_ ``sub.status`` _The status of the subscription. (1=Unpaid, 2=Active, 3=Cancelled, 4=Suspended, 5=Expired, 6=Past Due, 7=Pending Renewal, 8=Renewing, 8=Unpaid Order Failed)_ ``sub.start_date`` _The start date of the subscription_ ``sub.end_date`` _The end (or renewal) date of the subscription_ ``sub.current_template`` _The current subscription template._ [block:api-header] { "type": "basic", "title": "Subscription Template" } [/block] Represents the Subscription Template object, a snapshot of a subscription's state. This will carry relations that may change, such as the associated shipping address, product(s), and coupons on a subscription. When these aspects of a subscription are modified, a new subscription template is created, so the historical data is preserved. ``tpl.products`` _A list of products for the subscription._ ``tpl.coupons`` _A list of coupons on the subscription. This will not include coupons added during checkout, which are cart_coupons rather than subscription coupons._ ``tpl.note`` _A note on what caused the creation of a new template. For example: "Subscription initialization", "Subscription product changed by Jane Doe", "Coupon FREEBOX added to subscription renewal #123456789 by John Smith"_ ```tpl.created_at``` _When the template was created._ [block:api-header] { "type": "basic", "title": "Pay" } [/block] The Pay object represents a Customer’s payment processing data. ``customer_pay.exp_month`` _The expiration month of the card for this Pay object_ ``customer_pay.exp_year`` _The expiration year of the card for this Pay object_ ``customer_pay.last_four`` _The last four digits of the card for this Pay object_ [block:api-header] { "type": "basic", "title": "Address" } [/block] The Address object represents a Customer’s primary and/or shipping address. ``address.to`` _The Customer’s recipient line for this Address_ ``address.company`` _The Customer’s company name for this Address_ ``address.street`` _The street address of the Customer’s Address_ ``address.unit`` _The secondary address unit designator of the Customer’s Address_ ``address.city`` _The city field of the Customer’s Address_ ``address.state`` _The state field of the Customer’s Address_ ``address.zip_code`` _The zip code field of the Customer’s Address_ ``address.country`` _The country name of the Customer’s Address_ [block:api-header] { "type": "basic", "title": "Store" } [/block] The Store object represents your store. It contains all products, themes, and customers related to your store. ``store.name`` _The human readable store name_ ``store.has_gifting`` _Boolean, indicates at least 1 product can be bought with coupons_ [block:code] { "codes": [ { "code": "{% if store.has_gifting %}\n <a href=\"/subscribe/gift/\" class=\"btn\">Give a Gift</a>\n{% endif %}", "language": "jinja2" } ] } [/block] # PAGINATION QUERIES ``store.category_products(category)`` _Return a query products that can be passed to paginate. Filters with taxonomy = category_ [block:code] { "codes": [ { "code": "{% paginate store.category_products(category='helmets') by 4, page %}\n {% for product in paged_items %}\n {{ my_product_macro(4, product) }}\n {% endfor %}\n{% endpaginate %}", "language": "jinja2" } ] } [/block] ``store.shop_products(category=None, include_hidden=False)`` _Return query for e-commerce products that can be passed to paginate. You can filter by category = taxonomy, and include hidden products._ [block:code] { "codes": [ { "code": "{% paginate store.shop_products(category='birds', include_hidden=True) by 4, page %}\n {% for product in paged_items %}\n {{ my_product_macro(4, product) }}\n {% endfor %}\n{% endpaginate %}", "language": "jinja2" } ] } [/block] # ITERABLE PRODUCT LISTS The following store properties can all be iterated over in the same way, the key difference is what combination of ecommerce/subscription and visible/hidden filters you want to apply. [block:code] { "codes": [ { "code": "<!-- To iterate over subscription_products -->\n{% for product in store.subscription_products %}\n {{ my_product_macro(product) }}\n{% endfor %}", "language": "jinja2" } ] } [/block] ``store.products`` _A list of all Product objects attached to this store_ ``store.ecom_products`` _A list of only e-commerce Product objects attached to this store_ ``store.subscription_products`` _A list of only subscription Product objects attached to this store that are enabled for display._ ``store.subscription_only_products`` _A list of only subscription Product objects attached to this store including both enabled and disabled products._ ``store.visible_subscription_products`` _A list of only visible subscription Product objects attached to this store_ ``store.hidden_subscription_products`` _A list of only hidden subscription Product objects attached to this store_ ``store.visible_products`` _A list of visible Product objects attached to this store_ ``store.hidden_products`` _A list of hidden Product objects attached to this store_ [block:api-header] { "type": "basic", "title": "Product" } [/block] The Product object is the main representation of a product. It may have multiple variants, image data, subscription term ## PROPERTIES ``product.name`` _The human readable product name_ ``product.description`` _The human readable product description_ ``product.images`` _A list of images available for this product_ ``product.instances`` _A list of non-gift ProductInstance objects attached to this product_ ``product.giftinstances`` _A list of gift ProductInstance objects attached to this product_ ``product.taxonomy`` _A list of tags on an ecommerce product_ ## METHODS ``product.get_term_price(term_name=None)`` _Returns a TermPrice object, which links a price to a product Instance and a subscription Term. The TermPrice can be found by term_rank (0-numTermsEnabled)._ [block:code] { "codes": [ { "code": "<span>{{ product.get_term_price(term_rank=0).price | currency }}</span>", "language": "jinja2" } ] } [/block] ``product.get_variant_type_by_name(name)`` _Returns a VariantType object by name, useful for looping over all variant values by name._ [block:code] { "codes": [ { "code": "{% set style_variant = product.get_variant_type_by_name('style') %}\n{% for value in style_variant.values %}\n<!-- display values -->\n{% endfor %}", "language": "jinja2" } ] } [/block] ## MINIMUM-MAXIMUM PRICE RANGES Note: For convenience, you can and should use the get_price_or_price_range filter to avoid calculating ranges in your templates. ``product.calc_min_price(*variant_types, **kwargs)`` _Returns the minimum possible subscription price for the given variant types and choices._ [block:code] { "codes": [ { "code": "{% set min = product.calc_min_price(variant, values=chosen_values + [value]) %}", "language": "jinja2" } ] } [/block] ``product.calc_max_price(*variant_types, **kwargs)`` _Returns the maximum possible subscription price for the given variant types and choices. Useful for displaying price ranges for different variants._ [block:code] { "codes": [ { "code": "{% set max = product.calc_max_price(variant, values=chosen_values + [value]) %}", "language": "jinja2" } ] } [/block] ``product.calc_min_ecom_price(*variant_types, **kwargs)`` _Returns the minimum possible ecommerce price for the given variant types and choices. Useful for displaying price ranges for different variants._ [block:code] { "codes": [ { "code": "{% set min = product.calc_min_ecom_price(variant, values=chosen_values + [value]) %}", "language": "jinja2" } ] } [/block] ``product.calc_max_ecom_price(*variant_types, **kwargs)`` _Returns the maximum possible subscription price for the given variant types and choices. Useful for displaying price ranges for different variants._ [block:code] { "codes": [ { "code": "{% set max = product.calc_max_ecom_price(variant, values=chosen_values + [value]) %}", "language": "jinja2" } ] } [/block] [block:api-header] { "type": "basic", "title": "Variant Type" } [/block] The VariantType object represents a definable type of product option. Some examples would be a product’s Size, Color, or Style. ``variant_type.name`` _The defined name of the variant type_ ``variant_type.description`` _The defined description of the variant type_ ``variant_type.values`` _A list of available VariantValue objects associated with this VariantType_ [block:api-header] { "type": "basic", "title": "Variant Value" } [/block] The VariantValue object represents a definable option for a VariantType. A VariantType of ‘Size’ may have VariantValue objects such as ‘Small’, ‘Medium’, and ‘Large’. ``variant_value.value`` _The defined value_ ``variant_value.is_default`` _Boolean, whether this VariantValue is the default for its VariantType_ ``variant_value.description`` _The definable description_ ``variant_value.images`` _Associated images for this VariantValue_ [block:api-header] { "type": "basic", "title": "Product Instance" } [/block] The ProductInstance object represents a single configuration of a Product and its variant & subscription options ``instance.term_prices`` _A list of all TermPrice objects associated with this instance_ ``instance.calc_num_enabled_terms()`` _Returns the number of subscription terms enabled for this product instance_ ``instance.calc_term_discount(term_price)`` _Returns the term discount of the passed in TermPrice object. This is the percentage savings of the TermPrice vs the Instance’s single term cycle price, which indicates the savings of buying a multi-cycle term vs a single cycle term._ ``instance.sku`` _The SKU associated with this product instance_ [block:code] { "codes": [ { "code": "{% for term_price in instance.term_prices %}\n <span>Discount: {{ instance.calc_term_discount(term_price) | currency }}</span>\n{% endfor %}", "language": "jinja2" } ] } [/block] [block:api-header] { "type": "basic", "title": "Subscription Term" } [/block] The Term object represents a subscription term, which can have 1 or more cycles, depending on your configuration. ``term.name`` _The name of this term_ ``term.enabled`` _Boolean, whether or not this term is enabled_ ``term.description`` _The description of this term_ ``term.num_cycles`` _The number of cycles for this term_ [block:api-header] { "type": "basic", "title": "Subscription Term Price" } [/block] The TermPrice object represents the price for the intersection of an Instance and a Term ``term_price.price`` _The defined price for this Instance/Term combination_ ``term_price.term`` _The Term object associated to this TermPrice_ ``term_price.instance`` _The Instance object associated to this TermPrice_ [block:api-header] { "type": "basic", "title": "Order" } [/block] The order object represents a complete order on the platform and is only created after successful checkout ``order.financial_status`` _Payment for the order. One of: "pending", "authorized", "partial", "paid", "refunded", "voided"_ ``order.fulfillment_status`` _One of: "unfilled", "partial", "fulfilled"_. (Note: This field is immediately marked fulfilled for subscription orders. It's generally better to look at a shipment status.) ``order.is_renewal`` _Whether the order was generated automatically from a subscription renewal_ ``order.is_test`` _Whether the order was created while in Test Mode_ ``order.note`` _Optional note on the order added via the merchant portal_ ``order.placed_at`` _The datetime for when this order was placed_ ``order.refund_amount`` _The total refund for all transactions in the Order_ ``order.status`` _Order status: "open" or "closed"_ ``order.total`` _Grand total cost for order_ ``order.total_price`` _Total before shipping, taxes and fees. Just the cost of product._ ``order.transaction_fee`` _Fee applied by third party payment gateway_ ``order.total_shipping`` _Total price of shipping_ ``order.total_tax`` _Total taxes collected_ ``order.id`` _Order id._ ``order.products`` _List of product_\__instance objects, excluding gift cards and gifting 1.0 gifts._ ``order.gifts`` _List of product_\__instance objects, gifting 1.0 gifts only._ ``order.fulfillments`` _List of Fulfillment objects._ ``order.subscriptions`` _List of Subscription objects._ [block:api-header] { "type": "basic", "title": "Settings" } [/block] The Settings object represents any theme specific configurable settings that you define, like default theme colors and fonts, Designer configurations, and variables to be made available to Jinja2. Available Settings properties are defined in your theme’s ``config/settings_data.json`` file. Settings values can be accessed in templates as properties of the settings object. [block:code] { "codes": [ { "code": "<span>Current Main font choice is: {{ settings.face_main }}</span>", "language": "jinja2" } ] } [/block] **Output:** ``` Current Main font choice is: Lucida-Sans ``` The Settings object is also used in our Designer customizable fonts and colors. You can reference the settings object in your CSS files: [block:code] { "codes": [ { "code": "h2 .heading {\n font-family: {{ settings.face_main }};\n}", "language": "css" } ] } [/block] **Output:** ``` h2 .heading { font-family: Lucida-Sans; } ``` [block:api-header] { "type": "basic", "title": "Cart" } [/block] The Cart object represents a customer's cart, which may contain 0 or more products. You may access it on the checkout page simply by referencing `cart`, or on any other page by referencing `active_cart()`. ``cart.id`` _The integer id for the cart._ ``cart.anon_id`` _The string id for the cart, used in the URL. Null when customer is logged in._ ``cart.custom_data`` _Any metadata attached to this cart_ ``cart.customer_id`` _Customer id, or null if not logged in._ ``cart.store_id`` _The store id associated with the cart._ ``cart.products`` _List of product_instance objects, excluding Gifting 1.0 gifts._ ``cart.gifts`` _List of product_instance objects. (Gifting 1.0 only.)_ ``cart.ship_price`` _Shipping price. May be null before calculation on checkout page._ ``cart.tax_price`` _Tax price. May be null before calculation on checkout page._ ``cart.coupons`` _A list of coupons on the cart. Note: these are cart_coupon objects, not coupon objects. Each cart_coupon "c" will have a coupon referenced by c.coupon_ ``cart.gift_cards`` _A list of cart gift cards on the cart. Note: these are cart_gift_card objects, not gift_card objects. Each cart_giftcard "c" will have a gift card referenced by c.card_