Repository navigation
Shopify cart link changes language? Replace hardcoded URLs with routes #24
vistabylara-dev
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
إذا أعاد رابط السلة الزائر إلى لغة مختلفة، افحص الرابط المكتوب يدوياً. استخدم مسار Shopify المخصّص بدلاً من تثبيت عنوان السلة داخل القالب.
Free Shopify code series · 21/50 · Reviewed 24 October 2026
The problem and suggested fix
A customer browses in Arabic, taps a custom cart link, and lands on the wrong language path. One possible cause is a hardcoded /cart URL. Shopify's routes object supplies standard storefront paths that support localization.
Before editing
Duplicate your theme and work in the unpublished copy. Save the original files. This is a bounded code suggestion, not a universal theme repair. Keep the live store unchanged until preview checks pass.
Placement
In a duplicate, unpublished theme, locate the custom cart anchor in the relevant section or snippet. Replace only that anchor with this fragment. Merge the translation object into the root of locales/en.default.json; preserve existing keys and commas. Add the same key in active language files, for example عرض السلة in Arabic. Do not replace the entire locale file.
Liquid fragment — not a replacement for the full section:
Translation keys to merge into the existing locale object:
{ "vbl_links": { "view_cart": "View cart" } }Applicability and limits
This is a normal link to the cart page. It does not implement a cart drawer, add products, update quantities, or fix language/market configuration. If your theme binds drawer behavior to the original anchor's ID, classes or data attributes, preserve those and test its behavior instead of replacing them blindly. Avoid rewriting every URL sitewide.
Check before publishing
Preview the default language and each published language. Click the link from product and collection pages and confirm the destination language and cart contents. Test keyboard focus, empty and populated carts, mobile navigation and any existing drawer behavior. If the destination remains wrong, inspect Markets/language configuration and redirects; adding a path prefix by hand is not a reliable general fix.
Validation: The Liquid fragment and translation JSON passed Shopify's validation tool. No live merchant store was changed. Rendering, theme integration and commercial results have not been tested.
Rollback
Restore the original markup from your saved copy and remove only the translation keys introduced by this example if no longer used. If you published a modified theme and notice regressions, return to the saved working theme while diagnosing the cause.
Get help with your own store
Send Dr Lara your store URL, theme name, affected page and the change that preceded the problem. Start with free guidance and a free initial consultation. If you need implementation, the scope and fee are agreed separately before work starts.
Explore Shopify theme repairs and development with Vista by Lara
WhatsApp Dr Lara about this guide or call +971 50 799 4292.
Free guidance. No commitment. Practical implementation is separately scoped.
Share your experience
Did the problem start after a theme edit, an app installation, or a language change? Share a short sanitized example. Do not post passwords, tokens, customer data or private admin links.
Official references
Dr Lara · Vista by Lara · Dubai, UAE
All reactions