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
We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024