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.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Try to use useDiscountCodes API in javascript , but always fail ..

Try to use useDiscountCodes API in javascript , but always fail ..

HOLMESTANG
Shopify Partner
1 0 0

How to use javascript to access the standard api or other use api , I have extension like this at begin

 

export default extension( "purchase.checkout.contact.render-after", ( root, { ui, applyAttributeChange, applyShippingAddressChange, api } ) => {
 
And if I use this will fail
const discountCodes = api.useDiscountCodes();
 
Current I only can use the applyXXXXX function, Can't find way to use standard api or function that start with useXXX. 

Can someone give me some direction to learn. Thank you.
Replies 0 (0)