Translating Checkout UI extension settings field values

Are settings fields values for the Checkout UI extension really translatable right now? If so why isn’t it documented anywhere or did I miss it?

How to allow merchants to translate values they enter into those fields? They definitely should be natively translatable. The Shopify Support says they are but I couldn’t receive an answer in which way.

I was thinking of using metafields as a workaround but since there’s no way to track the saved value for a settings field, this option looks inadequate to me.

If anyone knows how to achieve that please share!

The settings for a checkout UI extension define a set of fields that the merchant can set a value for from the checkout editor

We can access the settings field values using the useSettings()
Hook. Please see the documentation:

Please refer the documentation for translate the settings fields values:

@AMaL Thanks for you reply but none of those pages describes the way to translate the field value which is entered by merchants through the Checkout Editor.

I was thinking of using metafields as a workaround but since there’s no way to track the saved value for a settings field, this option looks inadequate to me.

Utilize the useSettings() hook to retrieve the setting values defined by the merchant for the extension.

  1. Save Checkout Editor Field Values
  • Use two Settings fields in the Checkout Editor:
    • One for the description .
    • Another for the language (e.g., translation target language).
  • In the extension, describe in the selected language and save it as a metafield using the applyMetafieldsChange() hook.
  • Fetch the saved settings field values using the useSettings() hook.
  1. Display the Saved Values
  • Use the useLanguage() hook to get the store’s active language code.
  • Use the useAppMetafields() hook to retrieve the saved metafield value.
  • Compare the store’s active language with the metafield’s language code, and display the corresponding description.
  1. Save a translated description and its associated language using settings fields and applyMetafieldsChange().

  2. Fetch and display the description dynamically based on the store’s active language using useLanguage() and useAppMetafields().

FYI: I have not implemented this approach yet, and I’m not entirely sure if it will work as intended. It’s based on Shopify’s available APIs and hooks

Well, thanks for the try, but it has nothing to do with the reality. Not sure how exactly you’re going to use the language settings field without a dynamic value for it but If you will dig deeper you will see:

  1. Neither Order status nor Thank you page targets doesn’t have the applyMetafieldsChange hook in its API.
  2. There’s no way to save metafields along with settings fields values. If you will update a metafield each time a settings field changes then there’s a chance a merchant won’t save the entered values and as a result metafields values won’t be consistent with the settings fields values.

Thank you for pointing that out.

  1. Set a Separate Field for Language: In the Checkout Editor, we can introduce a dedicated field for the language (example: see the attached sample from an admin app).

  1. Save as JSON to Metafields: Store the values as JSON data in the app metafields, where each entry corresponds to the content for a specific language.
  2. Dynamic Display: Based on the active language, the content can be fetched dynamically and displayed using the previously mentioned.

Regarding the Thank You and Order Status pages, I wasn’t fully aware of your exact requirements earlier. Could you clarify your needs further?

1 Like

@AMaL you can’t add settings fields dynamically based on store languages list.