Change log

Discount codes

Provide discount code functionality for your Treepl CMS shopping cart. Ideal for promotions, customer loyalty and conversions or to help move more stock.

Discount codes are a powerful sales tool when used wisely and Treepl CMS can help you control how you utilise these. Control release and expiry date of codes, the type of discount (fixed price, percentage, free shipping...) and even how many times a code can be used.

Managing Discount Codes

Found under ‘eCommerce’ > ‘Discount codes’, here you’ll find a list of all discount codes created for use in your shopping cart.

Clicking the pencil icon () to the right of each item will allow editing of that discount code Clicking the trash can icon () will delete the discount code.

To manually create a new discount code, click the “ADD NEW CODE” button above the item list.

Adding / Editing

Here you’ll be able to configure the details of your discount code and enable it for use within your shopping cart.

Below are further details for the fields available.

The actual code your customers need to enter in order to redeem this voucher. This code can contain spaces and special characters and is not case sensitive(when redeeming).
The description,or notes,about the discount code providing further info to the admin user about the code. This value is not displayed on the front-end.

Fixed Amountallows the amount of the discount to be applied as a fixed value reduction of the total order price.

Percentage Of Orderallows the amount of the discount to be applied as a percentage reduction of the total order price.

Free Shippingallows the discount code to cancel out the cost of any shipping price applied to the order.

The value used to calculate the discount applied. This value can be a fixed amount or a percentage,depending on the ‘Type’ setting above.
The currency in which the discount code can be used.
Minimum Order Value
Assigns a restriction on the use of the discount code unless the order total exceeds,or is equal to,this minimum value threshold(before tax).
Use Expire After Redemption
Enable discount code expiration after a defined number of redemptions have taken place. The discount code will be marked as disbled once its redemption threshold has been reached.
Expire after x redemptions
A number defining the number of times the code can be used. This value will also reduce as redemptions occur.
Apply Discount to Selected Catalogs
Enable discount code to be restricted to selected catalogs only. The discount code will not be redeemable for orders containing products from catalogs not defined in the ‘Catalogs’ selection below.
Define the catalog/s allowed for use of this discount code.
Release Date
Set a date and time in which this discount code will become enabled for use in your shopping cart.
Expiration Date
Set a date and time in which this discount code will become disabled and no longer able to be redeemed in your shopping cart.
Set the discount code as enabled when checked(uncheck to disable).


Customers can redeem discount codes against products they are purchasing during the shopping cart stage. The discount code code is entered into a system input field and will update the cart details automatically after the customer has entered the code and moved focus from the field.
Discount code codes are not case sensitive so do not need to match the case of the discount code entered in the admin.

The predefined discount code input field can be rendered onto your shopping cart system page using Liquid via the discountCodeHtml property stored in the shopping cart Liquid object (which should already be present on your shopping cart page).

So, assuming you have the shopping_cart component added like this:

{% component type:"shopping_cart", layout: "", collectionVariable:"shoppingCartData" %}

You could then render the discount code input code like this:


And in conjunction, you could also render the applied discount code value like this:


The discount code amount will be applied to the order total in full if the order total is equal to or greater than the discount amount, or up to the value of the order if it’s lower.

If the discount code reduces the order total to 0 then you may want to conditionally switch your checkout payment method to ‘Free Payment’, otherwise you may still be asking the customer for credit card details (or whichever payment method you normally have in place).

One way to achieve this might be to add the select attribute to the payment method dropdown option (if you are using this element), like so:

<select id="Payment_Type" name="Payment_Type">
    <option value="CreditCard">Credit Card</option>
    <option value="Free" {% if shoppingCartData.totalPrice == 0 %}selected{% endif %}>Free Payment</option>
    <option value="Offline">Offline Payment</option>

Or, if you have implemented a hidden input to define the payment method, you could do something like this:

<input type="hidden" value="{% if shoppingCartData.totalPrice == 0 %}Free{% else %}CreditCard{% endif %}" id="Payment_Type" name="Payment_Type">

Related Articles

  • Domains
    The Treepl CMS Domain settings allow you to control default domain, landing pages, domain authentication for system emails along with country and cultural settings like number and currency formatting.
  • Payment Settings
    Integrate various payment gateways, for multiple countries and currencies, into Treepl CMS for form payments, subscriptions and eCommerce workflows.
  • Orders
    Orders store accounts of any payments made via the website and provide management for additional payments, invoices, order statuses, tracking info, the products purchased within the order and the details of the form submission used to take the order.
  • Advanced CRM Groups
    Advanced CRM Groups allow you to extend the data fields within multiple areas of the CRM, either globally or on a per-record basis.
  • {{ order }} object
    This liquid object will output the order details of a submitted payment. ...
  • module (Catalogs)
    This module component fetches data relating to eCommerce Catalogs and can be used to render Catalog structures and Products within them.
  • module (Products)
    This module component fetches data relating to eCommerce Products and can be used to render Product information.
  • ecommerce_add_to_cart
    This component renders an anchor element allowing the javascript function to add the item to the shopping cart.
  • ecommerce_buy_now
    This component renders an anchor element allowing the javascript function to add the item to the shopping cart and then proceeding directly to the shopping cart page.
  • ecommerce_item_quantity
    This component renders a form input element allowing a quantity to be set for when the source item is added to the shopping cart.
  • item_attributes
    This component fetches all attributes/options for a specified product. By default, each attribute group is rendered, with its options and any prices, according to their specified form inputs.
  • related_items
    This component fetches related items of a specific source item, such as a Product that has had Related Products assign to it.
  • grouped_items
    This component fetches grouped items of a specific source item, such as a Product that has been Grouped with other Products and allows the ability to navigate between grouped items.
  • currencies
    This component renders a form select element of all currency names, codes and symbols by default, and can also be used to output currency data to a Liquid collection.
  • shopping_cart
    This component fetches data relating to the shopping cart, such as any products added, order totals, tax, shipping, etc.
  • shipping_options
    This component renders a form select element of all shipping options configured on the site, and can also be used to output shipping option data to a Liquid collection.
  • shippingProviderFields
    This component provides a placeholder for populating additional Shipping Provider options to the user.
  • tax_codes
    This component renders a form select element of all tax codes configured on the site, and can also be used to output tax code data to a Liquid collection.
  • payment_form_fields
    This component is used to render payment fields, and payment related validation errors, within a form using the capabilities provided by your configured payment gateway.
  • orders
    This component fetches Orders from the CRM, either owned by the logged-in user or for all customer Orders.
  • Getting Started
    To get started with the eCommerce module there are some overall settings to configure that provide eCommerce with further context in order to function appropriately for your situation.
  • Products
    Products are one of the most powerful and flexible modules in Treepl CMS. Create customised product schemas with multiple price points, catalogs, inventory tracked attributes/variables, SEO optimisation and more.
  • Catalogs
    When organising any eCommerce store, Catalogs are crucial to your Products structure and browserbility. Easily create and customise unlimited product catalogs for your online store.
  • Gift vouchers
    Gift vouchers can be issued to your customers or purchased by them online via the shopping cart.
  • Taxes
    Create any number of required tax codes specific to the shipping country selected in your Treepl CMS shopping cart.
  • countries
    This component renders a form select element of all country names and country codes by default, and can also be used to output country codes/names to a Liquid collection.
  • domain_settings
    This module component retrieves settings associated with the current domain, or optionally from another specified domain configured in the site instance.
  • Shipping Options
    Treepl CMS provides the ability to configure both custom shipping options and integrated shipping providers based on a variety of conditions during the shopping cart stage.
  • Settings
    These various eCommerce settings allow you to further control and customise the way your website functions, both in the admin and on the front-end, in terms of eCommerce functionality.
  • eCommerce Javascript
    This is the provided javascript options for further controlling/customising the ecommerce javascript provided by the CMS.
  • Abandoned Cart Recovery
  • CRM Orders
    Return or update Order item/s via the public API endpoint.
  • Migrating to Advanced Payment Flow
    This article describes differences and possible required actions for migrating to the Advanced Payment Gateway flow.

External Resources

There are currently no external resources available.

Please let us know if you have any other contributions or know of any helpful resources you'd like to see added here.


We are always happy to help with any questions you may have.
Visit the Treepl Forum for community support and to search previously asked questions or send us a message at and we will consult you as soon as possible.