Automatic Discount on new one page checkout

Laiho
Shopify Partner
2 0 0

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 -%}

 

 

Replies 4 (4)

Liam
Shopify Staff
2731 302 783

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

Laiho
Shopify Partner
2 0 0

I use dawn theme, there in the snippets, file calls 'cart-drawer.liquid'

Liam
Shopify Staff
2731 302 783

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

Sasank_Zula
Shopify Partner
56 1 1

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.  

Regards
Sasank
Co-Founder, Zula
------------------------------
Increase cart conversion for Shopify Plus stores with Ace - https://apps.shopify.com/ace

Selling digital products? Files, Images, Webinar links, etc. Check out Wire - https://apps.shopify.com/wire