Theme conditions (pro) setup

The Offer Template app intentionally does not change any theme code to avoid leaving unwanted code in your theme.

However for the advanced offer targeting conditions that are available on the PRO subscription plan, the app needs some additional information for the targeting to work. 

Cart product conditions

For the offers to be targeted at specific collections or product tags based on the cart contents, add the following script tag:

    window.clCartProduct = { {% for item in cart.items %}
      "{{ item.key }}": { "tags": {{ item.product.tags | json }}, "collections": [{% for collection in item.product.collections %}{ "id": {{ }}, "title": "{{ collection.title }}", "handle": "{{ collection.handle }}" }{% if forloop.last == false %}, {% endif %}{% endfor %}] } {% if forloop.last == false %}, {% endif %}
    {% endfor %} };

Customer conditions

For the offers to be targeted at specific customers segments, add the following script tag:

    window.clCustomer = { {% if customer %}
      "id": {{ }}, "has_account": {{ customer.has_account }}, "email": "{{ }}", "name": "{{ }}", "orders_count": {{ customer.orders_count }}, "tags": {{ customer.tags | json }}, "total_spent": {{ customer.total_spent }}, "country": "{{ }}", "country_code": "{{ customer.default_address.country_code }}"
    {% endif %}};

Adding the script

This can be done in the Shopify Admin theme editor, navigate to   Online Store > Themes,  [More actions] > Edit Code.

Open the file "layout/theme.liquid" and paste each script tag before the closing of the </head>:

Verify the setup

To verify the setup and let the app know that the conditions are available, open the Offer Template app in the Shopify Admin and navigate into the "Settings" tab.

Click on the "Verify" button to let the app check your store and verify the installation. 

If the setup was successful you should see a green checkmark. You can now create offers that are using advanced targeting conditions. 

If you need further assistance, please send us a request and we will be happy to help you out.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.