Personalized checkout and custom promotions with Shopify Scripts
Afternoon, i've seen similar questions but i'm really struggling on the implementation.
I have experience with HTML, CSS & Javascript but not Ruby so it's rather confusing.
The script for the discount is contained in this link: https://www.pastiebin.com/5cdaa1632079b
I have looked and you can indeed reject discount codes using scripts, this is the code i found
Input.cart.discount_code.reject({message: "Save 10% with our Sets"})
However i cannot place this code inside my existing script without it erroring, can anyone point me in the right direction?
I worked this out myself, here is the correct code that needs to be added.
if Input.cart.discount_code Input.cart.discount_code.reject( message: "Discount codes cannot be redeemed with our Sets" ) end
The placement of the code is below, add the snippet just above the CAMPAIGNS = [ section and it works.
Thanks for the code. This works on my site too. Also is there any chance we could make this only works on the items with the discount. If the cart was mixed with discounted item and one without the discount, it rejects discount from all item even thought there's item without the discount.
Hey thanks for the code!
Works like a charm!
Quick question:
I have a script that applies a discount to a bundle of products.
Can we allow codes but only have them apply a discount on any item added except the bundle that the script will already have applied a discount?
@Nick_vas wrote:I have a script that applies a discount to a bundle of products.
Can we allow codes but only have them apply a discount on any item added except the bundle that the script will already have applied a discount?
For regular customer discount codes the easiest solution is to limit that discount code to a collection that the bundle products are NOT in, or some other omission setting.
It can be fast too IF all non-bundle type products are a type, or have a specific tag, or have data that can be used to make an automatic collection.
Otherwise this can be a manual chore however if you have a wide range of products/collections with bundleable products mixed in.
Mainly due to the fact that there will be no 'does not contain tag' setting for automatic collections which would let you tag the bundle products and omit only them from a collection that contains all products.
Save time & money ,Ask Questions The Smart Way
Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Buy Paul a ☕ Coffee for more answers or donate to eff.org
Thanks @PaulNewton ,
I like your idea.
However, in our case, we only have 4 products (one for each size) in total and each has different colors.
We just made a bundle option, which simply allows the customers to add 4, one of each size, and applies a discount.
So, if someone wants to add an extra one, we want to allow the discount coupon to apply only to the extra item.
Adding them into a collection won't work in that case as the discount code won't work.
(Hope I make sense 🙂 )
@Nick_vas you'll have to modify your scripts to just keep track of the number of items as a requirement, or carts total value and apply the discount to the extra item.
There's an example script similar to what your describing to get started with
and tangentially related https://help.shopify.com/en/manual/checkout-settings/script-editor/examples/line-item-scripts#free-g...
Depending on situation to get automatic discounts working with bundles sometimes you may need two sets of inventory as you need a clean way to distinguish bundled items from non bundled items in the admins discount logic, then need an app to keep inventory properly sync'd if your tracking inventory.
Save time & money ,Ask Questions The Smart Way
Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Buy Paul a ☕ Coffee for more answers or donate to eff.org
Hi @igolabs Nice! It looks like you added this code to a theme file. Which file is this?
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024