Personalized checkout and custom promotions with Shopify Scripts
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
User | RANK |
---|---|
2 | |
2 | |
2 | |
2 | |
2 |
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023