How to get Discount method when Build a discounts UI with Admin UI extensions

Topic summary

A developer is building a custom discount UI using Shopify’s Admin UI extensions and needs to retrieve the current discount method. They followed the official tutorial but couldn’t find how to access this information.

Proposed Solution:

  • Use the useDiscount() hook from @shopify/ui-extensions-react/discounts
  • Access the discount method via discount.method property
  • A code example was provided showing implementation

Outstanding Issue:
The original poster questions the accuracy of the suggested package (@shopify/ui-extensions-react/discounts) and requests documentation, as it appears the package reference may be incorrect. The discussion remains unresolved pending clarification on the correct package and documentation source.

Summarized with AI on October 30. AI used: claude-sonnet-4-5-20250929.

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.

  • Write the javascript.

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.