Get metafiels value in Post Purchase extension

Hi,
I am developing post purchase extension. I can’t get metafields value in shop field of InputData.
I set access.storefront = PUBLIC_READ, owerType = SHOP for metafield setting.
Thank you for your assistance and any solution you can provide.

Hi @nadiport

Are the metafields added to the .toml file? They should be added like this:

type = "post_purchase"
name = "checkout_post_purchase"

# [[metafields]]
# namespace: my-namespace
# key: my-key

# [[metafields]]
# namespace: my-namespace
# key: my-key-2

See example implementation here: Post-purchase extensions configuration

Hi @Liam-Shopify,
I added the metafields to the .toml file. But I build project, it show error

Can you post your .toml file with any sensitive data removed?

Hi, @Liam-Shopify
Here is my toml file configuration. I used shopify/cli to create post purchase extension.

@Liam-Shopify Do you have any solution for this problem? Thank you.

Hi again,

You don’t need to include the "" around namespaces and keys, see example:

I am also looking into this and I wonder how this works as the metafields in the api documentation (which you’ve screenshot) shouldn’t be read as they are commented out. Even if they are read, where would they show up? In the post purchase api documentation for shouldRender and the render extension points it shows 3 places where there are metafields added, the shop, product, and variant. Which one gets populated with these metafields? Does the logic run for each entity where there can be metafields and apply each of the described metafield namespace(s) and key(s) that are found in the toml file? Or are they searching on another owner type?
Please advise.

@Liam-Shopify Any advice on the question above?