How can I restrict my ecommerce site to mobile users only?

Hi all,

I would like to know what is the cleaner way to limit my ecommerce to mobile users only.

I want the same process as the password.liquid section, you know like

  • if the ecommerce is protected by a password then show this page
  • else show the website.

For my case, it would be β†’

  • if the user navigate throught desktop show a page (that says to open it from their phone)
  • else show website

I was thinking to do it via the app.js file.

What you guys think?

@witchiz

There are many ways to achieve this. The simplest approach would be something like this:

  1. In your Shopify Admin go to online store > themes > actions > edit code
  2. In your theme.liquid file, find the (press CTRL + F or command + F on Mac)
  3. paste this code right above the tag:

Naturally styling and adding extra functions will require programming knowledge, but this is a starting point.

Kind regards,
Diego

1 Like

Thanks for the reply.

I was wondering if we could load a liquid template inside the inner html fot better clarity in the code.

But that’s a good starting point thank you