Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

cant get discount code input value

cant get discount code input value

Razor989_
Shopify Partner
3 0 1

I have created a shopify app using CLI and have alse added Checkout UI extension to the app. You can see the checkout extension component in the screenshot given below. I would like to access all the input value entered in the discount code input field once i click apply button or before i click the apply button. I used the 

const discountCodes = useDiscountCodes() so as to console all the discount code which have been applied already. Is there any hook like the above mentioned so as to fetch the applied input values?

 Screenshot 2023-05-18 231447.png

Replies 10 (10)

vixnguyen
Shopify Partner
45 4 5

Hi Razor,

Please checkout this.

I guess this can help to solve solve your need.

Regards,

Razor989_
Shopify Partner
3 0 1

Hey, thanks for replying but i was looking to get all the values which are entered in the discount field even if they are not the correct discount code.

vixnguyen
Shopify Partner
45 4 5

Hi Razor,

Have you solved your problem? You can try another one.

Razor989_
Shopify Partner
3 0 1

Hey. I dont want to change the discount code. I just want all the values which are entered in the discount code field even if the entered discount code is incorrect. 

 

elena12355
Shopify Partner
3 0 2

Hi did you find any solutions for this?

 

Vijendra
Shopify Partner
7 1 0

hyy did you find the solution of this

 

elena12355
Shopify Partner
3 0 2

Hi
No. It's not possible to get the entered discount code value unless it's applied to the cart 🙂

Vijendra
Shopify Partner
7 1 0

so how can i archive this is there any way?

 

elena12355
Shopify Partner
3 0 2

unfortunately, there is no way to achieve this at the moment. but if you want to access the applied discount codes you can develop a checkout UI  extension app to handle the functionality. see docs blew:
https://shopify.dev/docs/api/checkout-ui-extensions/2024-04/apis/discounts
Or if you are a plus customer you can use a checkout UI extension app from the Shopify app store that does it for you.

Vijendra
Shopify Partner
7 1 0

yes I am using the checkout UI extension app from the Shopify but  I am unable to get the discount value entered in the discount field