7

I want to load device wise (like mobile and tablet) theme in Magento 2.

How can I do that?

I have tried below code in User Agent Rules but not working for me:

 iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini

5 Answers 5

8

Try to create multiple exceptions for each device enter image description here

1
  • Hi, can you help me? I tried this but on samsung tablet still loading desktop theme :( /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/
    – Brian NN
    Commented Jul 23, 2022 at 14:17
1
  1. In Admin Panel go to Content-> Design-> Configuration
  2. Choose the store that you need
  3. In Design Rule section add new User Agent Rules with next string:
    /iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini/i
    and choose the needed theme for mobile
0

Here is the tutorial for this: https://youtu.be/v7R46oqkPBs

0

I think the OP is looking at Magento 1.9 admin, while the responder is giving Magento 2.x admin instructions.

0
0

You can use below solution to catch every tablet and every mobile device for different theme.

I found one solution.

first you need to add user agent for tablet like as below.

/(tablet|ipad|playbook|silk)|(android(?!.*mobile))/i

with this user agent you will select every tablet device.

after that you need to add user agent for mobile device like as below.

/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/

with this user agent you will select mobile devices.

for more information about user agent you can check below link.

enter image description here

https://gist.github.com/dalethedeveloper/1503252

hope this answer will work for you.

Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.