less than a minute read • Updated 9 minutes ago
Cart variables reference
Reference for the Twig and JavaScript variables available on the cart template, including cart data and cart configuration.
The variables available on the cart template, exposed to Twig and to JavaScript in the FC.json object. Access array items in a loop, like {% for item in items %}{{ item.name }}{% endfor %}.
Cart
Variable | Description |
|---|---|
| URL for continuing back to the store from the cart. |
| Used to validate the locale storage version of FC.json.config is up to date. |
| true or false depending if the cart is the full page cart or not |
| Either cart, checkout or receipt. Used for configuring various display and functionality concerns. cart represents both Sidecart and full page cart versions. |
| Coupons associated with this cart. The {coupon_code} is the code value used by the customer to add the coupon. If the cart has shared coupon codes (the “Shared Codes Allowed?” checkbox is checked), the value becomes a nested array under that same {coupon_code} key — see the example below the table. |
| The custom fields associated with this transaction. The is_hidden bit will be true if the custom fields were passed in via the h: prefix. The {name} is the value of the name assigned to this custom field. |
| The time in seconds until the first product in the cart expires |
| Same as coupons above, but for products with a start date or next transaction date in the future. |
| The totals for subscription products with a start date or next transaction date in the future are grouped together here for the cart display. |
| Gift cards associated with this cart. The {gift_card_code} is the code value used by the customer to add the gift card. Note: The current_balance attribute will not factor in the discount that could apply from the cart or checkout. On the web receipt, current_balance will take into account the discount from that transaction, and any other uses of the gift card since then (if the receipt is being revisited). The email receipt will be the current balance of the gift card at the time the transaction was completed. |
| If the cart contains products which can have a coupon applied to them. |
| If the cart contains products with a start date or a next transaction in the future (a “future product”). |
| If the cart contains future products from categories which support shipping. |
| If the cart contains products from categories which support live shipping rates. |
| If the cart contains products from categories which have taxes based on the customer’s location. This is used for handling third party payment options such as PayPal Express and Amazon FPS. |
| If the store has multiship turned on. |
| If any of the products in the cart took advantage of the image option. |
| If the cart contains products from categories which support shipping. |
| If the cart contains subscription products. |
| If the cart contains products from categories which have taxes applied to them. |
| If all of the products in the cart are future products, this tells the system the shipping calculations will only be for future products. |
| If the cart contains a new subscription |
| If this transaction is for canceling an existing active subscription. |
| If this transaction is currently modifying an existing active subscription. This will usually mean there are products in the cart which will charge in the future. |
| If cart=updateinfo. |
| The sum total of all the product quantities in the cart. |
| An array of all the products in the cart. |
| Used in the alt attribute of the product link. |
| Product price before product option modifiers. |
| Product category code. |
| Product code or sku. |
| Parent product code or sku. |
| The delivery type of this product. |
| If this product is a downloadable, this is the downloadable id for it. |
| The timestamp for when this product expires. |
| Reserved for future use. |
| Unique internal id for this product. |
| The image url for this product. |
| If this product is a parent product or not |
| Used for organizing item display and managing the product update process. |
| Reserved for future use. |
| The multiship group number used for organizing products into shipments. |
| The product name. |
| Array or product options for this product. |
| The option name stripped of anything but letters, numbers, dashes and underscores so it can be used as a html class attribute. |
| The product option name. |
| The product option value. |
| The price extension of these products (price_each * quantity) |
| The actual price of an individual product after product option modifiers. |
| The quantity of this product in the cart. |
| The maximum quantity allowed in the cart for this product. |
| The minimum quantity allowed in the cart for this product. |
| The shipto name of this product used for multiship. |
| The end date of this subscription product. |
| The frequency of this subscription product. |
| The next date this subscription product will process. |
| The start date of this subscription product. |
| The url of this product. |
| The weight extension of the this product (weight_each * quantity) |
| The weight of an individual product. |
| Reserved for future use. |
| The English name for the language of the cart as set by the template set (like english, french, german etc). Can be blank if using the default template set. |
| The 2 character ISO code for the language of the cart as set by the template set (like en, fr, de etc). Can be blank if using the default template set. |
| Used for determining if a loading animation should currently be displayed. |
| The locale code for this cart such as en_US |
| This includes all of the data output by PHP’s localeconv() including currency symbols, decimal point character, and thousands separator. |
| Used for displaying error, warning, and information messages in the cart. |
| An array of error messages. |
| The context of this error message which often relates to a form input. |
| The content of the error message. Often times this will be blank as the error message is directly part of the template as a language string. |
| An array of informational messages. |
| The context of this informational message. |
| The content of the informational message. |
| An array of warning messages. |
| The context of this warning message. |
| The content of this warning message. |
| (Currently empty for the cart, may be added in the future) |
| True if payment information is required for this transaction (order total > 0 for an order and not doing a subscription cancel). |
| The session id of this cart. |
| The name of the FoxyCart session. |
| Container for the shipping address information. |
| Address 1 |
| Address 2 |
| The address name of this address (used mainly for multiship) |
| City |
| The city, region put togther as a string used in the select option. |
| Array of options returned from the postal code lookup. |
| City |
| Region (such as state or province) |
| Company |
| Two character country code |
| Country name |
| First Name |
| Last Name |
| Phone |
| Postal code |
| Prefix (used for multiship) |
| State or Province code |
| Label for this region (such as state or province) |
| State or province name. |
| A result of calculating live shipping rates. |
| This shipping method (USPS, UPS, FedEx, etc). |
| The quoted price for this shipping service. |
| The service id used by this shipping method for this service. |
| The name of this shipping service. |
| The description of this shipping service. |
| The shipping service id the service the customer selected. |
| An array of taxes associated with this shipping address. |
| Amount of this tax. |
| Whether or not this tax applies to handling fees. |
| Whether or not this tax applies to shipping costs. |
| The default amount before being applied to a specific location. |
| If this tax has an error. |
| If this tax is live. |
| The name of this tax. |
| The tax rate. |
| The internal id of this tax. |
| The total amount of future shipping costs for the products being sent to this address. |
| The total shipping costs for the products being sent to this address. |
| The total tax for the products being sent to this address. |
| The type for this address (either billing or shipping) |
| The label describing the shipping applied to this order. |
| Used to determine if the cart address entry form should be displayed. |
| Used for determining if the amazon payment button should be shown. It will not be shown if there are subscriptions in the cart. |
| Used for determining if the coupon input button should be shown. |
| Used to toggle the multiship details. |
| Used for determining if the Paypal payment button should be shown. |
| Used for determining if live shipping rates haven’t yet been calculated so a “TBD” indicator is displayed instead. |
| The FoxyCart store id for this store. |
| The code for the cart’s current template set |
| The total coupon discount applied to this transaction. |
| The total price of the future items in the cart. |
| The total amount of the shipping costs assigned to future products in the cart. |
| The total weight of the future shipable products in the cart. |
| The total price of the items in the cart. |
| The order total |
| The shipping total |
| The tax total |
| The total product weight. |
| The total weight of the shippable products in the cart. |
| The FoxyCart transaction id for the contents of the cart. |
Cart Config (FC.json.config)
Variable | Description |
|---|---|
| Path used for caching images in the FoxyCart system. |
| Used to validate the locale storage version of FC.json.config is up to date. |
| The base path of your store’s files served via the CDN. |
| The base path of static files served via the CDN. |
| The full path to the versioned store-specific stylesheet served by the CDN. |
| The currency format configured for your store and use for twig money formatting. |
| All language strings in FoxyCart are completely customizable. We start with a base language configuration and then you can customize them individually from there. |
| You can view all language strings used on the cart by viewing FC.json.config.lang in your browser’s web console. |
| A complete listing of all valid country codes and state/provinces within those countries used by our find-as-you type auto complete (FoxyComplete) country and region lookup system. |
| Locations are grouped by their 2 character ISO country code. |
| If this country is actively being used by the FoxyComplete system. |
| Alternative spellings or local spellings of this location name. |
| Used to give certain spellings a boost over others. |
| ISO 3166-1 alpha-2 code for this country. |
| ISO 3166-1 alpha-3 code for this country. |
| ISO 3166-1 numeric code for this country. |
| Country name (currently in english). |
| Postal Code format details. |
| If the postal code is numeric only. |
| The language key string for the description of this postal code. |
| The regex pattern this postal code fits in for validation purposes. |
| Whether or not the postal code is required. |
| Whether or not this country supports a postal-code based search. |
| Region details for this country. |
| The language key string for name of this country’s regions such as “state.” |
| Region information organized by two character ISO code. |
| If this region is actively being used by the FoxyComplete system. |
| Alternative spellings or local spellings of this region name. |
| Used to give certain spellings a boost over others. |
| ISO 3166-1 alpha-2 code for this country. |
| Region name (currently in english). |
| If regions are required for this country. |
| Locations used for billing address information only (see locations) |
| Locations used for shipping address information only (see locations) |
| Locale specific PayPal payment button URL. |
| URL for posting cart and checkout forms. |
| This FoxyCart stores FoxyCart store domain (the example part of example.foxycart.com). |
| Your store logo url as configured in the FoxyCart admin. |
| Your FoxyCart store name as configured in the FoxyCart admin. |
| Your store’s website URL as configured in the FoxyCart admin. |
| All of the settings configured in the FoxyCart admin under the configuration menu will be available here for you to use within your twig template customizations. |
| (UNDER CONSTRUCTION): A place to automatically configure your analytics tools. |
| Configuration settings for your Google Analytics account. |
| Your Google Analytics account id |
| Your Google Analytics account key |
| Configuration for how this setting is being used. |
| Configuration settings for your Segment.io account. |
| Your Segment.io account key |
| Configuration for how this setting is being used. |
| Configuration for how this setting is being used. |
| Settings for controlling the display details of your cart. |
| Whether or not to show the product category code in the line item details. |
| Whether or not to show the product code in the line item details. |
| Whether or not to show the product options in the line item details. |
| Whether or not to show the product weight in the line item details. |
| Whether or not the cart display config has been set or if defaults are in use. |
| Either default_account, default_guest, guest_only, or account_only for determining if your checkout will accept guest checkouts or required named accounts and which one will be the default action. |
| This configuration allows you to specify the main colors of your website and our system will adjust the CSS using SASS as needed to incorporate your colors into our template designs. |
| The primary, secondary, and tertiary colors for your website. |
| Whether or not this configuration setting is being used. |
| Settings for how you’d like to require the Card Security Code (CSC) for your website. Values include all_cards, sso_only (Single Sign On only), new_cards_only (do not require for saved cards). |
| Configuration for displaying and requiring various checkout fields and features. |
| These can be set to either hidden, required, optional, or default (in the case of billing_region) |
| Whether or not to allow cart controls on the checkout page. |
| Whether or not to allow the coupon entry form on the checkout page. |
| This is where you can put your own custom configuration values for your twig templates. This might be helpful if you want to hard code your templates with some logic and change the display outcome by just adjusting the values here. |
| Used for setting custom JavaScript or CSS elements to be used in the default template. |
| If you have custom JavaScript you’d like to add above the </body> tag for your cart, checkout and receipt templates, put that here. You can use it for conversion tracking scripts by checking the first_receipt_display variable. Full twig syntax is supported here. |
| If you have custom CSS (or JavaScript, though the footer is a better place for that) you’d like to add to the <head> tag for your cart, checkout and receipt templates, put that here. Full twig syntax is supported here. |
| If you to add custom fields to your store’s checkout template, add HTML here. These will be inside the <form> tag on the checkout page and will submit with the rest of the checkout form and be recorded as custom fields on the transaction. Full twig syntax is supported here. |
| Turn this on to see debugging output in your web browser’s console log. |
| How this setting is currently being used. |
| Our country and region auto completion system which lets users find locations as they type instead of having to select from a huge list of options. |
| The icon used for closing the location combo box. |
| The icon used for opening the location combo box. |
| Whether or not to show the location combo box. |
| Whether or not to show the country flags. |
| Configure how this feature is being used. |
| This allows you to easily add a “Subscribe Me” checkbox to your checkout template so you can use that value as a custom field in the transaction datafeed later. |
| How this setting is configured. |
| If you require the receipt page to be loaded over HTTPS, turn this feature on. |
| An array of the accepted payment cards by your store such as Visa, MasterCard, etc. This will control which card logos are shown on the checkout page. |
| Use this setting to easily add a terms of service checkbox to your checkout page. |
| Whether or not the terms of service checkbox is checked by default. |
| The URL to your terms of service document. |
| How this setting is configured (none, required or optional). |
| (UNDER CONSTRUCTION) A popup window for customers to confirm their order before submitting it. |
| Configure how this feature is being used. |
| The unit of measure used for calculating shipping weights. |
| Whether or not the current display output includes cart controls such as quantity and coupon entry fields. |