Discussing APIs and development related to customers, discounts, and order management.
Hello,
i changed to the new one page checkout.
Now all my automatic discount codes which i set in liquid. Doesn't work anymore.
What changed? Please I need help, this is very important for oure shop.
for example for the wholesale:
{% if customer.tags contains 'trader' %}
{%- if customer.tags contains '20%' -%}
<input type="hidden" name="discount" value="HÄNDLER_RABATT_20">
{% assign percentageTrader = 67.0 %}
{%- elsif customer.tags contains '25%' -%}
<input type="hidden" name="discount" value="HÄNDLER_RABATT_25">
{% assign percentageTrader = 63.0 %}
{%- elsif customer.tags contains '30%' -%}
<input type="hidden" name="discount" value="HÄNDLER_RABATT_30">
{% assign percentageTrader = 59.0 %}
{%- elsif customer.tags contains '35%' -%}
<input type="hidden" name="discount" value="HÄNDLER_RABATT_35">
{% assign percentageTrader = 55.0 %}
{%- elsif customer.tags contains '40%' -%}
<input type="hidden" name="discount" value="HÄNDLER_RABATT_40">
{% assign percentageTrader = 50.0 %}
{%- else -%}
<input type="hidden" name="discount" value="HÄNDLER_RABATT">
{% assign percentageTrader = 1.19 %}
{%- endif -%}
{%- endif -%}
Hi Laiho,
Where specifically was the code that you've pasted above?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
I use dawn theme, there in the snippets, file calls 'cart-drawer.liquid'
Hi again Laiho,
So if I understand correctly this snippet of code would pass a specific discount code into the checkout based on customer tags? It sounds like it was dependant on checkout.liquid being the checkout, or at least having the checkout having a specific structure. With the one-page checkout this approach to applying discounts may not be so easy - you may need to look into using Shopify Functions to achieve this now.
Hope this helps,
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi @Laiho
If you are on Shopify Plus, our app - https://apps.shopify.com/ace, can help you show the appropriate discount codes at checkout and one-click apply them.
Happy to help you with the same.