How to get Discount method when Build a discounts UI with Admin UI extensions
I have follow to this tutorial to create ui for custom discount but, don’t know how to get current discount method.
https://shopify.dev/docs/apps/build/discounts/build-ui-extension?extension=javascript
Thank you
Hi,
Hope this will help
-Use useDiscount() that helps you get the discount method inside your discount UI extension.
Javascript example
import { useDiscount } from "@shopify/ui-extensions-react/discounts";
export default function DiscountComponent() {
const discount = useDiscount();
return (
Current Discount Method: {discount.method}
);
}
Where can I find the docs about this package @Shopify_77 /ui-extensions-react/discounts, because seems like it’s not correct.
Thank you.