Personalized checkout and custom promotions with Shopify Scripts
Hi There,
I'm trying to create a script which will cancel a tiered discount when a customer has a BOGO (5+1) in his cart. But only on the bogo. The other products in the cart should not be affected.
What I can't seem to find is a way to code something as:
" if Product Z is added 6x then customer gets 1 for free, tiered discount is cancelled on this item"
Next to that, if customer buys 12x product Z, customer gets 2 for free, and so on.
Also, if customer buys 2 items of product Z the tiered discount will be active.
Would be nice to get some help with this!
@Frank_Z
You are probably going to want to set this up at the beginning of the script because it is priority. My recommendation is to store the affected line items in an Array.
After that you would check to see if the Array contains the line item that might be affected by the tiered discount part of the script and if it is then ignore it because it was already discounted.
If variant ID's themselves could work for a reference to check against then you can store those in an Array instead of the line item itself.
That should sufficiently help to ensure that your BOGO discount takes priority over the tiered discount for the line items that should have the BOGO discount applied to them.
Hope that helps!
Hey Rob, thank you for your reply.
I'm not that deep into coding and eventually, after I recognised this stuff went way over my head, found a shopify script creater. It does a little more then I could code but it isn't the final sollution because it keeps returning errors. I guess due to too much code-lines.
Do you know if there is an easy way to get the CPU usage down?
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024