Thanks for taking the time to demonstrate this. Is it possible to apply/remove discount codes on specific cart line items? Before I'd use Script Editor to prevent discount codes from applying on cart line items if they contained a specific tag. I haven't figured out how to use the Checkout UI Extensions to achieve the dame. The Cart Lines API doesn't remove the discount when the discountAllocations attributes is set to an empty array and the Discounts API doesn't seem to allow targeting a single line item.
@Stacking Context thanks for all your videos! I'm learning alot from your videos which are clear and explanatory. I like how you explain the process of where you find certain data. Would you be able to do a tutorial on price changes depending on seletected payment methods or other changes during checkout? Like add charge if choosing pay with PayPal or discount if choosing pay with other options.
Not exactly the same, but the upcoming Discount Allocator function also has the ability to reject discount codes: shopify.dev/docs/apps/selling-strategies/discounts/discount-function-examples/discounts-allocator Shopify Functions as custom apps are only available to Shopify Plus stores, but if an app from the Shopify App Store is using functions you can install it on non-Plus stores and it should work.
@@stackingcontext thanks, Im interested in finding something similar to useDiscountCodes() to listen for when users apply discount codes in checkout, but without having to use Checkout UI if possible. I was exploring perhaps Storefront API... would this have a similar listener?
hello @Stacking Context Nice work but I want to show all coupon codes from the backend to the cart page as a suggestion so the customer can choose from it
Your best bet would be to store them all in a shop metafield and then display that as a text checkout extension. That being said, it's rarely a good idea to just hand people all your discounts so they can pick the best one for them. Discounts should be used to get people who wouldn't have purchased at full price across the line. By handing everyone all your discount codes, all you're really doing is just making your products cheaper. Which could be more easily achieved by....making your products cheaper.
Aside from what @SimonShinkins suggested, you can also get the active discount codes by using the DiscountCodeNode query in your Checkout UI Extension and displaying the results at checkout.
I have a discount shopify function that creates a automatic discount. What could I do so I can apply another discount on top of the automatic one. Could this be done with a checkout extension? Example: DEMO50 -> 50% automatic percentage and DEMO30 -> 30% not automatic percentage When I apply the last one(DEMO30), a messages appears that I can not use DEMO30 The message is "DEMO30 couldn't be used with your existing discounts" So, Is it possible to apply another discount in addition to the first one? Or It is not possible?
When registering your discount use the combinesWith field from the API. Both discounts must be set to combine. shopify.dev/docs/api/admin-graphql/unstable/input-objects/DiscountAutomaticAppInput
Your explanation is amazing and tried to create a shopify UI extension but how to get the coupon code value when it is not a valid one. Which function or hook i need to use? And i want to use only default text box and button of shopify checkout Currently i am trying to call applydiscountcodechange and usediscount code but these hooks give me only applied coupon code i want which are not valid and cuustomer trying to apply them Thank you in advance
You can get all applied discounts using the useDiscountAllocations hook, then sum them and that should be the total amount. shopify.dev/docs/api/checkout-ui-extensions/2024-04/apis/discounts#useDiscountAllocations
Thanks for taking the time to demonstrate this.
Is it possible to apply/remove discount codes on specific cart line items? Before I'd use Script Editor to prevent discount codes from applying on cart line items if they contained a specific tag. I haven't figured out how to use the Checkout UI Extensions to achieve the dame. The Cart Lines API doesn't remove the discount when the discountAllocations attributes is set to an empty array and the Discounts API doesn't seem to allow targeting a single line item.
You will need to use a Shopify Function for this to create a discount that ignores items with certain tag.
@Stacking Context thanks for all your videos! I'm learning alot from your videos which are clear and explanatory. I like how you explain the process of where you find certain data.
Would you be able to do a tutorial on price changes depending on seletected payment methods or other changes during checkout? Like add charge if choosing pay with PayPal or discount if choosing pay with other options.
@Stacking Context, if there any way to show the discount coupon on the checkout extension and if we click on it, it get applied autmoatically.
Great stuff. Is there a similar solution available if store does not have Shopify Plus?
Not exactly the same, but the upcoming Discount Allocator function also has the ability to reject discount codes: shopify.dev/docs/apps/selling-strategies/discounts/discount-function-examples/discounts-allocator
Shopify Functions as custom apps are only available to Shopify Plus stores, but if an app from the Shopify App Store is using functions you can install it on non-Plus stores and it should work.
@@stackingcontext thanks, Im interested in finding something similar to useDiscountCodes() to listen for when users apply discount codes in checkout, but without having to use Checkout UI if possible. I was exploring perhaps Storefront API... would this have a similar listener?
Can we hide (discount field) from checkout?
Not possible as far as I know.
do you have a full course?
No. Is there any content you'd like to see that has not been covered in the channel yet?
hello @Stacking Context
Nice work but I want to show all coupon codes from the backend to the cart page as a suggestion so the customer can choose from it
Your best bet would be to store them all in a shop metafield and then display that as a text checkout extension. That being said, it's rarely a good idea to just hand people all your discounts so they can pick the best one for them. Discounts should be used to get people who wouldn't have purchased at full price across the line. By handing everyone all your discount codes, all you're really doing is just making your products cheaper. Which could be more easily achieved by....making your products cheaper.
Aside from what @SimonShinkins suggested, you can also get the active discount codes by using the DiscountCodeNode query in your Checkout UI Extension and displaying the results at checkout.
I have a discount shopify function that creates a automatic discount.
What could I do so I can apply another discount on top of the automatic one.
Could this be done with a checkout extension?
Example:
DEMO50 -> 50% automatic percentage
and
DEMO30 -> 30% not automatic percentage
When I apply the last one(DEMO30), a messages appears that I can not use DEMO30
The message is "DEMO30 couldn't be used with your existing discounts"
So, Is it possible to apply another discount in addition to the first one?
Or It is not possible?
When registering your discount use the combinesWith field from the API. Both discounts must be set to combine.
shopify.dev/docs/api/admin-graphql/unstable/input-objects/DiscountAutomaticAppInput
Your explanation is amazing and tried to create a shopify UI extension but how to get the coupon code value when it is not a valid one. Which function or hook i need to use?
And i want to use only default text box and button of shopify checkout
Currently i am trying to call applydiscountcodechange and usediscount code but these hooks give me only applied coupon code i want which are not valid and cuustomer trying to apply them
Thank you in advance
I'm not aware of a method to get the invalid coupon codes the customer tried to apply.
how to get the information of total discount amount ?
You can get all applied discounts using the useDiscountAllocations hook, then sum them and that should be the total amount.
shopify.dev/docs/api/checkout-ui-extensions/2024-04/apis/discounts#useDiscountAllocations