Using Slide Cart with Weglot
A more automated way to use Slide Cart with Weglot is currently being worked on. In the meantime, Slide Cart can integrate with Weglot using a custom script.
Pre-requisites:
- Set up Weglot on your store with the desired languages.
Make sure the app is enabled in the theme App Embeds.
Step 1: Determine the two-letter language code.
Before we add the custom script we must figure out the language code(s). A detailed list can be found here. For example, if I was translating to German the code would be "de".
Step 2: Add the custom snippet
Once you've determined the code copy and paste the snippet below into your theme.liquid file, just below the closing <body>
tag.
script> window.SLIDECART_OPENED = function() { var lang = document.querySelector('html').getAttribute('lang').toLowerCase() if (lang == "nl") { window.SLIDECART_STATE().settings.rewards_pre = "Spend *{{ amount }}* more for 10% off" window.SLIDECART_STATE().settings.rewards_post = "10% off activated!" window.SLIDECART_STATE().settings.rewards_amount = "100.00" window.SLIDECART_STATE().settings.rewards_shipping_text = "FREE" window.SLIDECART_STATE().settings.title_text = "Cart" window.SLIDECART_STATE().settings.note_text = "Add an optional note" window.SLIDECART_STATE().settings.note_placeholder_text = "Special instructions" window.SLIDECART_STATE().settings.discounts_label_text = "Discounts" window.SLIDECART_STATE().settings.shipping_label_text = "Shipping" window.SLIDECART_STATE().settings.shipping_value_text = "FREE" window.SLIDECART_STATE().settings.subtotal_label_text = "Subtotal" window.SLIDECART_STATE().settings.checkout_text = "Checkout" window.SLIDECART_STATE().settings.upsell_add_text = "Add" window.SLIDECART_STATE().settings.upsell_add_long_text = "Add to cart" window.SLIDECART_STATE().settings.upsell_unavailable_text = "Unavailable" window.SLIDECART_STATE().settings.empty_text = "Your cart is empty." window.SLIDECART_STATE().settings.custom_html_footer = "" window.SLIDECART_STATE().settings.custom_html_header = "" window.SLIDECART_STATE().settings.custom_html_checkout = "" window.SLIDECART_STATE().settings.custom_html_empty = "" window.SLIDECART_STATE().settings.continue_shopping_text = "Or continue shopping" window.SLIDECART_STATE().settings.discount_box_label = "Discount code" window.SLIDECART_STATE().settings.discount_box_error_text = "Invalid discount code" window.SLIDECART_STATE().settings.discount_box_button_text = "Apply" window.SLIDECART_STATE().settings.subscription_text = "Subscription" window.SLIDECART_STATE().settings.checkbox_text = "I agree to the terms of service." window.SLIDECART_STATE().settings.checkbox_note_text = "TOS accepted" window.SLIDECART_STATE().settings.vendor_key_text = "Vendor" window.SLIDECART_STATE().settings.product_type_key_text = "Product type" window.SLIDECART_STATE().settings.aupsell_heading = "Recommended Products" } } </script><br>
Step 3: Add your translations
Once the snippet is pasted in, change the language code inside of the snippet on line 5.
For example, If I was translating to Spanish I would change if (lang == "nl") {
to if (lang == "es") {
Afterward, translate all of the text within the quotes below and hit save.
Step 4: Test your store
Everything should be working at this point, give your store a test. If anything goes wrong please contact us and we'll help you get set up.