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!
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?
Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...By Gabe Jan 6, 2023
How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...By Skye Dec 30, 2022