Shopify / ui-extensions

MIT License
268 stars 36 forks source link

Discount metafields are not available to read in a checkout ui extension. #393

Open allan-hodlfy opened 2 years ago

allan-hodlfy commented 2 years ago

Please list the package(s) involved in the issue, and include the version you are using

Describe the bug

When creating a product_discount extension / shopify function, we are adding metafield data into a namespace/key that is attached to the new discount being created.

Our expectation was that we could then read this metafield data from the checkout-ui-extension by specifying the namespace/key in the shopify.ui.extension.toml file.

However, the data is not being shown in the extension appMetafields.

After some discussion in the Shopify discord, it was mentioned that this use case may not have been considered yet. https://discord.com/channels/842813079926603828/993570246361362462/994316477442302093

Steps to reproduce the behavior:

  1. Create new product_discount extension as per tutorial
  2. On create, add metafields using specific namespace/key combination and include in the discount data.
  3. Create new checkout ui extension
  4. Update metafields section of shopify.ui.extension.toml to request access to the namespace/key from the discount extension.
  5. In checkout-ui extension react code, console log extensionApi.appMetafields and you'll find it empty

Expected behavior

Expectation is that metafield data for the specified namespace/key combo will be available for the checkout ui extension to view and use when rendering the checkout extension.

sjanczy2 commented 2 years ago

Updated label to enhancement, I can understand this use case.

Amigache commented 1 year ago

We have the same issue, we need access to the discouns metafieldas... any progress?

joeainsworth commented 8 months ago

Yes, same here. When a customer adds a discount code we want to gift them a free product. We can add the product with a checkout extension UI component. However, we need to be able to access the discount configuration so we know what product to add.

Any update on this?