Need some help?

I'm usually available for small jobs or problem solving with jQuery or css, at reasonable rates. Just get in touch.

Web Hosting

We recommend Clook for web hosting. UK based, great service and great value.

Buy me a drink

If you've found this useful, particularly for commercial projects, you might consider making a small donation.

Opencart – Setting up multiple stores

Here’s how to set up multiple stores on Opencart using subdomains. You could use this to set up a separate store to run a different theme – for example a mobile-optimised theme.

Create your subdomain

Let’s assume you’re running your main store on www.yourstore.com, and that your web hosting locates the files for your store in its root directory public_html. For a mobile store, let’s also assume you’re going to sit this on m.yourstore.com.

You need to create your new domain and point it at the same folder that your main store uses. If your hosting uses cPanel then it should look something like this:

Screenshot of additional domain in cPanel

Create your new store

The next step is to create the new store in Opencart. Go to System > Settings and click the ‘Insert’ button. This should bring up screens to create your new store. For the Store URL and SSL URL, enter your new domain, adding https to the SSL URL if you have a certificate installed. Make sure you close your entries with a ‘/’ or it won’t work. Fill out the rest of the details on the General tab, and your screen should look something like this:

Screenshot of Opencart store configuration screen

Now the Store tab. Here you need to enter the store name, and select the theme you want to use (e.g. a mobile theme). Set the default layout to ‘Default’. Your screen should look something like this:

Screenshot of Opencart store configuration screen

You can then save your new store.

Configure your new store

Opencart will create your new store with all the default settings, so you will need to amend all the store settings as required.

Opencart will not load any categories, products, manufacturers or information pages to your new store (unfortunately?). You’ll need to do all these manually, or by running some SQL queries from the backend. To do this manually:

  • Categories – From the Category edit screen, go to Data > Stores to mark the checkbox against your new store.
  • Products – From the Product edit screen, go to Links > Stores to mark the checkbox against your new store.
  • Manufacturers – From the Manufacturer edit screen, mark the checkbox against your new store.
  • Information – From the Information edit screen, go to Data > Stores to mark the checkbox against your new store.

Modules in your new store – using Layouts

If you’re using Opencart 1.5 or later, then any Modules that you have configured will not be carried over to your new store. This is a good thing, I think, since it effectively gives you control over which modules are used by your different stores. Opencart manages the display of extensions by using the concept of Layouts – which is a little tricky to grasp, I think.

A Layout is the entity which links Modules to pages and stores. When a page is to be displayed on a store, Opencart looks up the layout appropriate to that page on that store, and then finds any modules configured for that layout.

So, if you make no changes to any Layouts after creating your new store, then when a page on your new store is displayed, Opencart will search for the appropriate Layout, and not find one, so no Modules will be displayed. So, to display a Module on your new store, we need to configure a Layout.

I’ll illustrate this with an example. Let’s assume you have some Modules on your default store homepage, and you want to display the same Modules on your new store. First thing is to navigate to System > Design > Layouts and click ‘Edit’ against the ‘Home’ Layout. You should then see something like this:

Screenshot of Opencart store configuration screen

You’ll see that the existing (default) entry tells Opencart that for the default store the Layout ‘Home’ should be used with the route, or page ‘common/home’ – which is the home page. We need to tell Opencart to use the same Layout for the new store. So, click ‘Add Route’, select the new store and enter ‘common/home’ against the route – like this:

Screenshot of Opencart store configuration screen

Click ‘Save’ and you’re done.

You can probably see from this that it’s possible to display different modules on your new store homepage by creating a new Layout and assigning it to your new store only. Here’s some more details on how to do this.

You’re done

Once this is complete, your new store should display via the subdomain, with the products etc and modules that you have enabled in the steps above. Payment, Shipping and Order Totals will all be the same as your existing store.

Tags:

60 responses to “Opencart – Setting up multiple stores”

  1. Smit Shah says:

    Thanks for this..
    Opencart is not having anything for modules & banners for multi-store ?

  2. Simon says:

    Smit
    Yes, you can do this with layout. Have a look at this explanation.

  3. Admin says:

    How can i configure the store? I can’t find your configure style in the Admin Panel of Opencart, please give the solutions quickly.

  4. Admin says:

    Where i can install your mobile script? Directly in the root folder of hosting panel or in the folder name with M in Public_Html folder?

  5. Simon says:

    The theme should be unzipped in the root folder of your Opencart installation.
    Once installed properly you should be able to assign the theme to a store.
    You shouldn’t have a separate folder if you’re installing a mobile theme – see the instructions above.

  6. Admin says:

    Check my testing website :- m.area83.tk It shows some errors, how can i solve it? I’m using Opencart1.5.5.1

  7. Simon says:

    I don’t think those errors are coming directly from the mobile theme. Your default store is showing the same and additional errors.
    Do you have vqmod installed properly?

  8. Dave says:

    I got it all woking but only issue i cant get the product image to show on my mobile site m.

    opencart 1.5.1

  9. Simon says:

    Dave

    I can’t access your mobile site at the moment. I’ve not come across that issue. What happens? Does the rest of the site display OK?

  10. Dave says:

    I got it fixed just had to change the image file name from my mobile path to the website inage folder

  11. Don says:

    Hi thanks for this!

    My store is in a subdomain and i installed this mobile theme in the root of subdomain where is my opencart store. But it dont work not show the mobile theme.
    Is there any sollution?
    Thank you Simon!

  12. Simon says:

    Don

    The theme will not automatically detect a mobile browser as it stands. Have a look here for ways the theme can be employed.

  13. Don says:

    Thank you work fine now!

    One more question if i have thousands products than how can i import to the mobile store just one by one?

    Thank you Don

  14. Simon says:

    Don
    You can run some SQL on your database to do this – have a look here for description.

  15. Donovan says:

    Hi Simon

    Thanks for the above worked a charm. But now I’m having issues with SSL. The main site is http://www.assceneon.com and I have multistore set up with http://www.babycakescoffee.com as the second site. I have SSL cert for assceneon.com (shared) but when I go to https://www.babycakescoffee.com it does not go to the secure site only non secure http:// can you help? Does open cart offer this? I have looked into wildcard SSL but my hosts says that they cannot handle it and nor can opencart! Any help is appreciate

    Regards

    Donovan

  16. Simon says:

    I haven’t done this myself, so check before buying, but I think what you need is a multi-domain SSL certificate.

  17. Tim says:

    Hi, thanks for the tutorial, I followed the directions but when I go to my subdomain. mobile.domainmcom which should go to domain.com/store, it goes to domain.com instead. I did include the / in setup, a common mistake I read people made. I am running 1.5.5.1 thanks.

  18. Simon says:

    Hi Tim

    That sounds like you’ve got your cPanel set up correctly but there’s something wrong with the Opencart settings.

  19. Admin says:

    My we hosting provider is serversfree.com where i can create subdomains but can edit it, can’t make document root to public_html, when i try to make subdomain there, a new folder ‘m’ is created in the root folder of database. Now how can i solve this issue?

  20. Simon says:

    That sounds like one to take up with your hosting provider really, it’s not something that I can help with.

  21. Mark says:

    Hi Simon
    I am just setting up my multistore and seem t have most things working properly, but I have noticed that when I now try to add a new product that only the manufacturers from the second store show up iin the links tab – I have a lot of manufacturers in the default store but none of these appear.
    Any pointers on how to resolve this?

  22. Simon says:

    It sounds like you don’t have the manufacturers enabled for your second store – like products, they can be enabled/disabled by store.

  23. zjunyu says:

    Good Job, Thank you.

  24. Tim says:

    Thank you for answering my question earlier, you say the CPANEL is setup properly, which I know, but the Opencart is now. I have followed your instructions several times, to see what I may have missed, and everything is exactly as you show. Any suggestions? It still goes from http://mobile.domain.com to the domain.com site.

  25. Simon says:

    From your earlier question, is your store in a subfolder? If so is this correct on your subdomain on cPanel?

  26. taun khanna says:

    if i want to use two sites are on sub domains but there is no site on main domain .i just put a html page on main domain and put two links on it. then how will i manage both stores

  27. Simon says:

    I’m not quite sure what you’re asking. If you have two subfolders you can still set them up in cPanel to resolve the the same address and run them as one OC installation.

  28. Ian Haney says:

    Help I am stuck and not sure what to do

    I have unzipped the theme and put inside a subfolder called m and followed all the instructions and redirected it using the php code but I just get a blank white page

    The mobile site is http://www.the-giftery.co.uk/m/

    Any ideas where I gone wrong

    Kind regards

    Ian Haney

  29. Tim says:

    Well, I went back to check it and it does now lead to the mobile template like it should. Now my problem is nothing loads. I get Home My Account Shopping Cart at the top, then the footer showing powered by opencart, and the name of the store.

    I did go through the process of adding the store to the categories, products etc. I also went into the modules, and did what your tutorial shows.

  30. Tim says:

    I was able to get it working, way back when I disabled the mobile_theme.xml because of a PHP error which made my site almost useless. I forgot it was still disabled. I did however find that the PHP error was with the VQMOD Refine Search Sub Category Images, which was the only free mod that allowed sub category images. If you purchase another version, it does not edit files, and works great with your mod. Thank you for a great script!

  31. Simon says:

    Ian

    Sorry for the delay in replying, I have been on holiday.
    From what you describe, it sounds like there might have been an issue with your Opencart configuration – which is why you got the blank page.
    If you’re still trying to make this work get back in touch.

  32. Ashraf Tayab says:

    Dear Sir,,,
    Thank you for your Opencart – Setting up multiple stores, I am new with opencart, by reading your Opencart – Setting up multiple stores, I understand to make multiple stores.
    Thank you

  33. Agus Halim says:

    hi
    thanks for this great articles, i would like to know how is it possible to separate individual admin login page separate product, separate anything so when we totally create a new store in multistore it’s just like new setup. and other store only can see their dashboard, sales and item?
    thanks

  34. Simon says:

    If you’re running multiple stores from on installation then the stores share the database, so the products are stored in a single table (for example). Short of writing a fair bit of code for admin so that users can only see products from a specific store, there’s no way of doing what you want.

  35. Agus Halim says:

    hi
    since i’m not a programmer i would like to know the code how to tweak so with this single table the users only can see their products from a specific store. any paid/free service do let me know. many thanks

  36. Simon says:

    Hi Agus

    Within Opencart you can assign a product to a store, and therefore restrict certain products to only appear in specific stores. Is that what you meant? If not could you explain exactly what you’d like to be able to do?

  37. Charles says:

    Hi Simon

    I am trying to create a multistore in opencart following your steps but what happens is when I open the subdomain http://www.shopcharles.centrodelvalle.com, it doesn’t charge the home page and anything.

  38. Simon says:

    I get a not found error on your subdomain. This suggests that the subdomain isn’t set up correctly rather than anything to do with Opencart.

  39. johnny p says:

    Good morning,

    I create all steps specified here:
    1. I create an sub-domain using CPanel
    2. I specified from setting on ¨Adress URL¨ as your description : http://demo1.my-shopping.ro/

    So, I don´t see the theme choose instead of those message which can be see if you will type in browser the adress of my sub-domain.
    What I don´t understand is if the steps is so simple, why don´t work?

    I waiting much early is possible your answer and advice or other sugestion which can help me to resolve the error.

    Thank you in advance for support and collaboration.
    Best regards.

  40. Simon says:

    The problem there is with the subdomain – for some reason this is not working as expected. I think this is probably an issue to take up with your hosting company.

  41. Robin says:

    Hi, can you assist me for multistore? Is it possible to set multistore in different domain? Like my Main store is set into ABC.com and i want to set another store in different domain as XYZ.com. Is it possible?
    I am also getting issue related to layout thing, as its showing some modules in all pages of substore.

    Thanks
    Robin

  42. Simon says:

    You can run multistore on different domains, yes.
    You can control which modules appear by creating a layout which is store specific.

  43. simon says:

    Hi
    Great article – the only place I’ve seen mention of layouts which had flummoxed me for a while!
    I have a multi-store setup but in admin on my second store, on the server tab of settings I only see the Use SSl section and nothing else. Any idea how this has happened or how to correct it?

  44. Simon says:

    That’s not an error. The rest of the settings can only be set per server, rather than per store, and so only appear on that tab on the default store Settings > Server tab.

  45. simon says:

    Really? I’ve spent ages trying to spot what was wrong!
    If that’s the case how do I put the second store into maintenance mode but leave the default store live?

  46. Simon says:

    You can’t do that out of the box – I dare say there’s an extension that’ll do it. However, you could do this via by creating a specific maintenance theme which has nothing on it except a ‘sorry’ message, and then setting your desired store to use the maintenance theme.

  47. simon says:

    That’s a good idea. I’m slowly getting the hang of Opencart but odd little tricks like that evade me for now.
    Really appreciate the help.

  48. Jacky Wu says:

    Hi Simon,
    I have problem with multi-store setup on my Opencart 1.5.6 with default theme. I have recently registered a new domain, not subdomain of my main one. I then followed the instruction on Opencart forum to create multi-store using different domain. However, when I tried to access the new domain, I was expecting to see the default Opencart storefront. It did not show me that, rather a default web site page saying that the domain have been moved or something. Do you have any idea what is wrong? Thanks.

  49. Simon says:

    Are the two domains on the same hosting? If not then you will need to load up Opencart files on the new hosting as well – although you can use one database to server both sites. I have done this and it works fine – the only minor challenge is managing images across two sites.
    If they are on the same hosting then fro what you say there could be something wrong with how you have the domain set up in cPanel.

  50. Moni says:

    Thanks for the useful guide. Some of our customers are having troubles setting up their stores, so we will make sure we send them your way.

  51. Adam says:

    Hi Simon, thanks for the tutorial…
    Are you able to explain the first part of the setup in more detail for me. I ask, as I can’t get this step to work.
    You state to point the document root to the folder where the files for your store are kept.

    I have an opencart store installed in public_html/domain/store/
    When I create a subdomain – I should use public_html/domain/store/ as the root? Or should it be public_html/domain/ ? Does it need to have the trailing ‘/’?
    I’ve stride both and neither redirect to the open cart front. I have added the domain into OC settings but when I go to the newsite.com I get the standard hosting provider 404 page.
    I have tried a variety of combinations without success.

  52. Simon says:

    Hi Adam
    If your OC files are in public_html/domain/store then yes, the subdomain should point at this directory. You don’t need the trailing slash. If you’re just getting a 404 there’s something wrong somewhere, obviously. I’m assuming this problem has persisted for a while (subdomains tend to take an hour or so to become accessible due to caching etc) – if so it might be something to take up with your hosting company.

  53. Adam says:

    Cancel that last comment – I worked out that although our store was in a /store/ folder, the install for OP was actually in the root (!). This was hard to spot as we have 100+ domains in the root. Thank you anyway!

  54. Mr. T says:

    Product categories are not displaying on the mobile theme or subdomain but are displaying on the the primary site. Kindly advise.
    Cheers!

  55. Simon says:

    Have you enabled the categories for your secondary store?

  56. kernelbit says:

    Hi Simon, I need multiple stores, but in two different hosting providers(2 domains in hosting ‘A’, and 2 in ‘B’), I read comment 49(yours..), but I can’t understand it very well…can you explain it a little bit more detailed, please? Thanks in advance

  57. Simon says:

    Not the simplest thing to do. First all the files need to be duplicated across both stores, then you need to set your database (say on A) to be able to receive remote data requests from B. You’ll want to monitor the response time for this as well.
    You should be able to set up the sites as normal from Opencart admin.
    The messiest bit is uploading images because you need the images to be duplicated across both servers. However, Opencart will only upload the images to the server you’ve logged on as admin. You could add some code to FTP to the other server when the image is uploaded or perhaps set both sites to use the images on one server. I’ve done the former but not tried the latter.
    I’m assuming you can’t have all the sites on one server because you want multiple SSL certificates?

  58. kernelbit says:

    “…can’t have all the sites on one server because you want multiple SSL certificates?”
    Nope… My boss have some kind of personal interest on maintaining the 2nd host… but I’ll say him it’s so complex, so I hope he will understand…
    Anyway, I’ll try this…who knows

    Thanks!!!

  59. Mark Welton says:

    Great tutorial. I have set up several different multi-stores under my main site. Question: How can I add customized or multi-store specific “About Us”, “Terms”, “Social links”, etc? This is preferred but If I can’t, then can I hide the footer on those pages?

    Thanks,

    Mark

  60. Simon says:

    OC allows Information pages to be set by store, so you should just be able to define which store(s) a page should appear on. Not sure if ‘Social Links’ is a page as well or actual links in the header etc. If the latter then this can be set by store, perhaps by creating a different theme for each store and amending the header.tpl within the theme to reflect what you need.

Useful? Interesting? Leave me a comment

I've yet to find a way of allowing code snippets to be pasted into Wordpress comments - so if you're trying to do this you'd be better off using the contact form.