Giter VIP home page Giter VIP logo

Comments (4)

leeuwis avatar leeuwis commented on August 22, 2024

Hey @MaSchVam, that should definitely be possible! After installing the headless theme, did you define the "Base URL" in the theme settings? This should look like this:

Screenshot 2022-10-12 at 14 42 51

from shopify-headless-theme.

MaSchVam avatar MaSchVam commented on August 22, 2024

Hey @leeuwis ,
Yes! This is the setup we are using. However, this behavior persists:

Example: headless app is at https://detitalienskekoekken.dk

This is the base URL that I want to send people to.

I then have a checkout here:
https://detitalienskekoekken.myshopify.com

And if you visit that URL, you will see that the theme redirects properly (Great!).

However, to make the checkout URL look more legit, we use this domain alias within Shopify:

https://kasse.detitalienskekoekken.dk

If you visit that URL, you can verify in the browser tab that we enter an infinite redirect loop.

from shopify-headless-theme.

MaSchVam avatar MaSchVam commented on August 22, 2024

@leeuwis ,

Instead of getting the shop url on line 28 in theme.liquid, I now just grab window.location.href. This should cover this use case?

from shopify-headless-theme.

leeuwis avatar leeuwis commented on August 22, 2024

@MaSchVam I've opened a PR with a fix, let me know if this fixes the issue for you!

It's indeed fixed by changing the value on line 28 in theme.liquid, but I ended up using window.location.hostname instead of the window.location.href. If window.location.href would be used, all traffic will always be redirect to the home url of your storefront, but the path should also stay intact so https://example.myshopify.com/products/slug-x also gets redirected to https://example.com/products/slug-x.

Please read the note in the PR when updating, since a settings_schema.json has been changed.

from shopify-headless-theme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.