Personalized checkout and custom promotions with Shopify Scripts
To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more
Hi everyone, firstly having read so many posts on here regarding scripts etc it's great to see the help you guys all give so Thank you, you have already helped me with other issues which I have resolved!!!
Unfortunately, I haven't been able to find my solution, hence this post.
I have "inherited" a script and it seems that I keep getting a run time error, mainly when the site gets really busy (could just be coincidence).
The error points to the line starting "when CartDiscount::Percentage" but I assume this is the start of this particular block of code?
My gut tells me it's the line below "Input.cart.subtotal_price * ((Decimal.new(100) - Input.cart.discount_code.percentage) / 100) " but I don't understand Ruby that well.
The error message is "Message: new line_price must be lower than the current line_price"
cart_discounted_subtotal = case Input.cart.discount_code when CartDiscount::Percentage if Input.cart.discount_code.code.start_with? 'XX' or Input.cart.discount_code.code.start_with? 'spec-' Input.cart.subtotal_price elsif Input.cart.subtotal_price >= Input.cart.discount_code.minimum_order_amount Input.cart.subtotal_price * ((Decimal.new(100) - Input.cart.discount_code.percentage) / 100) else Input.cart.subtotal_price end when CartDiscount::FixedAmount if Input.cart.subtotal_price >= Input.cart.discount_code.minimum_order_amount [Input.cart.subtotal_price - Input.cart.discount_code.amount, Money.zero].max else Input.cart.subtotal_price end else Input.cart.subtotal_price end
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022