Some instructions and examples here
Display applied discounts inside your theme
You can now display any applied discount directly inside your store. Works with discount codes applied by our tools.
This requires editing your theme's liquid files from the shopify admin section here.
Can I test the feature before paying?
Yes, you can test this feature for free. As long as you are logged in as an administrator [?] the feature will be considered enabled. We compiled an article with some of the most popular use-cases for the feature, you can read more about it here.
How do i install it?
- Step 1: Locate the liquid file you want to edit. Most common location is
cart.liquid
orcart-template.liquid
- Step 2: Add the following element
<span data-tbnadfield='DISCOUNT_CODE' data-tbnadhide='NEVER' data-tbnaddefault='No discount code'></span>
The example above would render to something like10PERCENTOFF
orNo discount code
if no discount code was applied by our app. - Step 3: See and replace
DISCOUNT_CODE
andNEVER
with one of the values in the table below.
For the examples below, we apply a discount code 10PERCENTOFF to a $45 cart. |
|
---|---|
data-tbnaddefault | |
Any value you set in this field, will be used as the default value if nothing else can be shown. | |
data-tbnadhide | |
NO_DISCOUNT | Field will be hidden if no discount code was applied by our app. |
HAS_DISCOUNT | Field will be hidden if a discount code was applied by our app. |
Empty / Any other value | Our app won't try to hide the field |
data-tbnadfield | |
DISCOUNT_CODE | Title of the discount code applied by our app. Ex: 10PERCENTOFF |
CART_SUBTOTAL | Cart subtotal (amount before discount). Ex: $45 |
CART_DISCOUNT | Cart discount. Ex: $4.5 |
CART_TOTAL | Cart total (amount after discount). Ex: $40.5 |
CART_SUBTOTAL_CENTS | Cart subtotal in cents (amount before discount). Ex: 4500 |
CART_DISCOUNT_CENTS | Cart discount in cents. Ex: 450 |
CART_TOTAL_CENTS | Cart total in cents. (amount after discount). Ex: 4050 |
data-tbnadfieldcustom | |
any global javascript function | Example function:
window.cart_weight_in_kg = function (data){ console.log(data); return data.cart.total_weight / 100; } |