Scripts not stacking with function discounts

theo-radiant
Shopify Partner
4 0 0

Having an issue with cart scripts stacking with function discounts. If I use a generic shopify discount code it stacks with the cart script meaning some items have 2x discounts which is expected, however if I then create a discount code via a function discount, it no longer stacks with the script discount and all items have 1 discount from the function, is this a bug?

 

So:

native shopify discount code + cart script = stacks discounts

function discount code + cart script = doesn't stack, function discount is always applied

Replies 8 (8)

MastersHub
Shopify Partner
187 17 26

I know that the script + function discount is applied because I've been in the same situation as you. Have you made the combination selection? Maybe the issue is related to that. I want to help you, but I need more details. Can you provide more information?

Helpful ? Like and Accept Solution
Buy me a Coffee
Need a Shopify Developer?
Send Email or Chat on WhatsApp
theo-radiant
Shopify Partner
4 0 0

Yeah have tried changing the combination settings and nothing changed unfortunately. Even with a native shopify discount and the combinations disabled it still stacked with the script discount (as I believe combinations are just for multiple shopify discounts rather than discounts + scripts). I tried the function discount with all combinations enabled and disabled and the outcome was the same, only the function discount was being applied

 

 

MastersHub
Shopify Partner
187 17 26

Don't you want Script + Function discounts to work together?

Helpful ? Like and Accept Solution
Buy me a Coffee
Need a Shopify Developer?
Send Email or Chat on WhatsApp
MastersHub
Shopify Partner
187 17 26

I'm running both function discount and script discount together. There might be another issue. It requires checking the codes. I don't have any issues; it works in both scenarios.

Helpful ? Like and Accept Solution
Buy me a Coffee
Need a Shopify Developer?
Send Email or Chat on WhatsApp
theo-radiant
Shopify Partner
4 0 0

It seems it's because it's causing the script to error when the function is running

 

I'm getting a "can't convert nil into Decimal" error, even with the simplest line item script possible which doesn't make sense:

Output.cart = Input.cart

 

 

 

MastersHub
Shopify Partner
187 17 26

Since I can't see the exact line that is causing the error, I can't specify its exact location. However, if you perform a nil check before the line that is causing the error, the issue should be resolved.

Helpful ? Like and Accept Solution
Buy me a Coffee
Need a Shopify Developer?
Send Email or Chat on WhatsApp
theo-radiant
Shopify Partner
4 0 0

Hi,

 

The full script contents is the following (only 1 line) and the error is still being caused:

Output.cart = Input.cart

 

Screenshot here also:

7a09e05b969df4267d1aa3ce2c874c2b.png
 
It seems functions are causing the script to error even with nothing in
MastersHub
Shopify Partner
187 17 26

It doesn't give me any errors either. Shopify scripts are behaving a bit oddly, but I am sure that 1 script 1 function is working because I have tested the same combination, and both are working simultaneously. To understand the problem you are experiencing, a detailed examination is necessary. It seems like you opened a single-line code to test. If you delete the current script and create a new empty script, the issue should be resolved. I would be happy to assist. I am looking forward to your responses.

 

script.png

Helpful ? Like and Accept Solution
Buy me a Coffee
Need a Shopify Developer?
Send Email or Chat on WhatsApp