[WEBHOOK] How to know if dicsounts is added to cart?

KHCoolrunner
New Member
6 0 0

Hi Shopify,

Im working with an app that provide delivery methods to shopify defined some rulesets like if that cart is above 599 DKK it should be free delivery and such.

But my problem is that i dont know if there is any discount added to the cart such as 25% discount so the cart total would be 449.25 DKK and therefore the shipping method should not be free anymore.

But if a customer add a discount code to the cart i still receive the full price 599 DKK and no informations about that a discount code is added to the cart. How do i solve this? I really need to know if a discount code is added or just the price after the discount.

Array
(
    [rate] => Array
        (
            [origin] => Array
                (
                    [country] => DK
                    [postal_code] => 9000
                    [province] => 
                    [city] => test
                    [name] => 
                    [address1] => test 37
                    [address2] => 
                    [address3] => 
                    [phone] => 
                    [fax] => 
                    [email] => 
                    [address_type] => 
                    [company_name] => test
                )

            [destination] => Array
                (
                    [country] => DK
                    [postal_code] => 9000
                    [province] => 
                    [city] => test
                    [name] => Test
                    [address1] => test 2b
                    [address2] => 
                    [address3] => 
                    [phone] => 60606060
                    [fax] => 
                    [email] => 
                    [address_type] => 
                    [company_name] => 
                )

            [items] => Array
                (
                    [0] => Array
                        (
                            [name] => test
                            [sku] => 20411_800
                            [quantity] => 1
                            [grams] => 800
                            [price] => 20250
                            [vendor] => test
                            [requires_shipping] => 1
                            [taxable] => 1
                            [fulfillment_service] => manual
                            [properties] => Array
                                (
                                )

                            [product_id] => 6218664411315
                            [variant_id] => 38121211527347
                        )

                    [1] => Array
                        (
                            [name] => test
                            [sku] => 80041_1500
                            [quantity] => 1
                            [grams] => 1500
                            [price] => 35859
                            [vendor] => test
                            [requires_shipping] => 1
                            [taxable] => 1
                            [fulfillment_service] => manual
                            [properties] => Array
                                (
                                )

                            [product_id] => 6218651467955
                            [variant_id] => 38121149071539
                        )

                )

            [currency] => DKK
            [locale] => da
        )

)

Above you see the code i receive from the webhook when i need shipping methods. 

0 Likes