Home > front end >  liquid Shopify - how to access the current URL
liquid Shopify - how to access the current URL

Time:11-26

I need to access the URL when in the cart as there is an issue with the locale that I need to fix. I tried {{ shop.secure_url }} and {{ page.url. }} and many more but couldn't access it. Any idea? Thanks


CodePudding user response:

Check the request object: https://shopify.dev/api/liquid/objects?shpxid=ae783aed-8802-4157-ED00-1067D234E633#request it should contain everything you need.

{
  "design_mode": false,
  "host": "polinas-potent-potions.myshopify.com",
  "locale": {},
  "origin": "https://polinas-potent-potions.myshopify.com",
  "page_type": "index",
  "path": "/"
}
``

CodePudding user response:

thanks but still not working. I can't access the full URL in mini-cart.liquid . I used this conditional statement:

{% if request.locale.iso_code == "de" and request.origin contains 'https://myshop.ch' %} href="/{{ request.locale.iso_code }}/checkout"

  • Related