Translate BYOB bundle builder elements
For instructions on how to set up your BYOB, see: How to create a BYOB (build-your-own-bundle) experience on Shopify using Simple Bundles
Some text displayed in the Build Your Own Bundle interface is not currently translated by Shopify’s native translation tools or apps such as Translate & Adapt. This customization translates those labels according to the active storefront language.
The provided snippet already includes the BYOB interface labels covered by this customization. You only need to update the language code and translated text values.
Before you start
Create a duplicate of your live theme before making any code changes:
- In Shopify admin, go to Online Store > Themes.
- Find your live theme.
- Click the three-dot menu.
- Select Duplicate.
- Complete the installation on the duplicated theme.
- Preview and test the duplicated theme before publishing it.
The BYOB app embed must also be enabled in the theme for the Build Your Own Bundle interface to appear.
Step 1: Add the translation snippet
- In Shopify admin, go to Online Store > Themes.
- Find the duplicated theme.
- Click the three-dot menu and select Edit code.
- Open the Snippets folder.
- Click Add a new snippet.
- Name the snippet:
sb-byob-translations.liquid
- Paste the complete translation snippet here.
- Click Save.
Step 2: Load the snippet on product pages
- In the theme code editor, open the Layout folder.
- Open
theme.liquid. - Scroll to the bottom of the file.
- Find the closing
</body>tag. - Add the following code immediately above it:
{% if template.name == 'product' %}
{% render 'sb-byob-translations' %}
{% endif %}
- Click Save.
The snippet will now be loaded on product pages. It will only apply translations when the active storefront language has a matching configuration and the BYOB interface is present.
Step 3: Configure your translations
The translationConfigs section at the top of the snippet controls the storefront translations.
The following German configuration can be used as your example. It already contains the translation for all labels and buttons:
const translationConfigs = {
de: [
// Product/component action buttons.
// Includes Select, Added, Add, Out of stock,
// and the maximum quantity message.
{
selector: '.byob-cta',
replacements: [
{
originalText: 'Select',
translatedText: 'Auswählen'
},
{
originalText: 'Added',
translatedText: 'Hinzugefügt'
},
{
originalText: 'Add',
translatedText: 'Hinzufügen'
},
{
originalText: 'Out of stock',
translatedText: 'Nicht auf Lager'
},
{
originalText: 'Max quantity added',
translatedText: 'Max hinzugefügte Menge'
}
]
},
// Remove button shown for a product already added to the bundle.
{
selector: '.byob-resource__remove-text',
replacements: [
{
originalText: 'Remove',
translatedText: 'Entfernen'
}
]
},
// "Add a product" title shown in the bundle builder.
{
selector: '.byob-resource__title',
replacements: [
{
originalText: 'Add a product',
translatedText: 'Produkt hinzufügen'
}
]
},
// Bundle mini-cart and Add to Cart area.
// Includes the remaining product count, Add bundle to cart,
// and Added to cart confirmation.
{
selector: '.byob-mini-cart__checkout',
replacements: [
{
textPattern: /Add (\d+) more/g,
translatedText: 'Noch $1 hinzufügen'
},
{
originalText: 'Added to cart',
translatedText: 'Zum Warenkorb hinzugefügt'
},
{
originalText: 'Add bundle to cart',
translatedText: 'Bundle zum Warenkorb hinzufügen'
}
]
},
// Product details link shown inside the BYOB product options modal.
{
selector: '.byob-options-modal__details-link',
replacements: [
{
originalText: 'See full details',
translatedText: 'Alle Details anzeigen'
}
]
}
]
};
Quick option: Generate translations with an AI assistant
You can use an AI assistant to add one or more languages to your existing translationConfigs object.
Replace [LANGUAGES] in the prompt below with the languages you want to add, for example French, Spanish, and Italian , then paste your current configuration or the German language configuration object above.
Add the following languages to my Simple Bundles BYOB `translationConfigs` object: [LANGUAGES] Please follow these instructions carefully: * Preserve all existing language configurations exactly as they are. * Do not remove, replace, or modify any languages already included in the object. * Add a new configuration only for each requested language that is not already present. * Use the correct two-letter ISO language code as the property name for each new language, for example `fr` for French or `es` for Spanish. * Duplicate the complete translation structure from an existing language configuration for each new language. * Translate only the `translatedText` values. * Keep every `selector` unchanged. * Keep every `originalText` unchanged. * Keep every `textPattern` unchanged. * Preserve `$1` exactly wherever it appears, placing it appropriately in the translated sentence. * Preserve the JavaScript structure, comments, brackets, commas, and formatting. * Do not add or remove translation entries. * Use natural storefront wording appropriate for ecommerce rather than overly literal translations. * Return the complete updated `translationConfigs` object, including both the existing languages and the newly added languages. * Return only the JavaScript configuration, without explanations before or after it. Here is my current configuration: [PASTE YOUR translationConfigs OBJECT HERE]
After the AI assistant generates the additional language configurations, you can review and fine-tune any translation by updating its translatedText value.
For example:
{
originalText: 'Select',
translatedText: 'Sélectionner'
}
You can change only:
translatedText: 'Your preferred translation'
Leave originalText , selector , textPattern , and any $1 placeholders unchanged..
Manual option: How to build the configuration object with translations
Each translation configuration begins with a two-letter language code:
de: [
In this example, de is the language code for German.
The script checks the active storefront language and uses the configuration with the matching language code.
Some common examples are:
de = German fr = French es = Spanish it = Italian nl = Dutch
If you want to translate the BYOB interface into French, for example, you would change:
de: [
to:
fr: [
and then replace the German translatedText values with your French translations.
Update the translated text
For most entries, you only need to change translatedText .
For example:
{
originalText: 'Select',
translatedText: 'Auswählen'
}
originalText is the text generated by the BYOB interface.
translatedText is the text your customers will see.
If you are creating a French translation, you could change it to:
{
originalText: 'Select',
translatedText: 'Sélectionner'
}
Leave originalText unchanged so the script can identify the original BYOB text.
You should also leave the selector values unchanged. These tell the script which part of the BYOB interface each group of translations belongs to.
Dynamic quantity message
One translation is slightly different:
{
textPattern: /Add (\d+) more/g,
translatedText: 'Noch $1 hinzufügen'
}
This handles messages where the number changes, such as:
Add 1 more Add 2 more Add 3 more
The $1 in the translation represents that number.
For example:
Add 3 more
becomes:
Noch 3 hinzufügen
When translating this message into another language, keep $1 where you want the number to appear.
For example:
translatedText: 'Ajoutez encore $1'
Leave the textPattern unchanged.
Add another language
If your store uses more than one language, you can keep the German configuration and add another one.
The easiest way is to duplicate the complete de configuration, including everything inside its [ and ] .
For example, you can start with:
const translationConfigs = {
de: [
// German configuration
]
};
Then duplicate the complete language block and add a comma between the two configurations:
const translationConfigs = {
de: [
// German configuration
],
fr: [
// French configuration
]
};
The important parts are:
- Keep the complete set of selectors and replacement entries for each language.
- Change the language code, such as
detofr. - Change only the
translatedTextvalues for the new language. - Keep the
originalText,textPattern, andselectorvalues unchanged. - Add a comma between each language configuration.
For example:
const translationConfigs = {
de: [
{
selector: '.byob-cta',
replacements: [
{
originalText: 'Select',
translatedText: 'Auswählen'
}
]
}
],
fr: [
{
selector: '.byob-cta',
replacements: [
{
originalText: 'Select',
translatedText: 'Sélectionner'
}
]
}
]
};
In the actual snippet, duplicate the entire configuration, not just the .byob-cta example above.
You can add additional languages in the same way:
const translationConfigs = {
de: [
// Complete German configuration
],
fr: [
// Complete French configuration
],
es: [
// Complete Spanish configuration
]
};
When a customer changes the storefront language, the script detects the active language and uses the corresponding configuration.
If there is no configuration for the active storefront language, the script does not apply any translations and the original BYOB text remains unchanged.