How do i limit extensions.settings.fields to a specific target?

How do i limit extensions.settings.fields to a specific target?

JonnaWiberg
Shopify Partner
23 2 11

Hey!

I have a small issue with extension.settings.fields, how can i limit so that a settings.fields will only show up for a specific target? because now when i add the app blocks in both "shipping page" and "thank you page" all these settings appear.

Skärmavbild 2024-08-12 kl. 11.01.55.png


But i would like only the first two to only show for the shipping target, and the last one to only appear on the thank you page, is this possible? else they would be just shown twice on the different blocks.

heres the snippet from my extenstion.toml

[[extensions.targeting]]
module = "./src/Checkout.tsx"
target = "purchase.checkout.shipping-option-item.details.render"

[[extensions.targeting]]
module = "./src/PickupConfirmation.tsx"
target = "purchase.thank-you.customer-information.render-after"

[extensions.settings]
[[extensions.settings.fields]]
key = "door_consent_message"
type = "single_line_text_field"
name = "Door consent message"
description = "Message for the door consent field"

[[extensions.settings.fields]]
key = "pp_not_selected_error"
type = "single_line_text_field"
name = "Error message for no pickup point selected"
description = "Error message when no pickup point is selected"

[[extensions.settings.fields]]
key = "confirmation_message"
type = "single_line_text_field"
name = "Message for pickup confirmation on thank you page"
description = "Shown below the order on the confirmation page"
Reply 1 (1)

Liam
Community Manager
3108 340 871

Hi Jonna,

 

It's not possible to limit specific setting to particular pages currently - the settings are universal to the extension, so you would need to create an additional extension at the targets you don’t want the settings to show up at.

 

You can create that additional extension in the same TOML file though- however the extension itself will have different names.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog