7

I have a client who needs a multi-store setup. They require the contents of the cart to be shared between websites. Also when the customer switches between websites, the cart item(s) price may be different and in different currencies.

Is this possible to do? As far as I am aware its possible between store views. Any information would be much appreciated.

Thanks.

8
  • What is the motivation to be using Websites versus store views? Jan 31, 2013 at 10:35
  • I am currently doing some research and store views might actually be fine. Do you know if a product has different prices per store view will this change in the cart when you switch store views? Jan 31, 2013 at 10:55
  • As price isn't a user-definable attribute, you cannot change the scope from global > store. You can change it from global > website via System > Configuration > Catalogue > Price. So it is not natively possible to change price per store view (lest, not via the admin GUI) Jan 31, 2013 at 11:29
  • OK, thanks for your help Ben. I will keep looking into it. Jan 31, 2013 at 11:32
  • This is answered on stackoverflow: stackoverflow.com/questions/12374289/… Feb 12, 2013 at 11:08

3 Answers 3

7

Magento does not allow sharing carts between websites. The sessions objects for individual websites are completely detached, products in one website may not belong to the other website, the category structure and visibility of data will be different. As you pointed out, the pricing may be different from one website to another as well, as could the promotions, tax rates, etc.

From a data perspective, it would be rather difficult to share carts between websites given that a product you may have in your cart may or may not be in the next website you go to. This would create major problems with products disappearing and/or errors in the cart due to products not being available.

Something like this would have to be completely custom built, and I'm certain it would not come without it's problems and anomalies.

Without knowing more to contextualize the situation, I'm skeptical that using multiple websites with different prices and currencies plus sharing the cart between them is the best solution. If the pricing and the currencies are different, why do the carts even need to be shared? Doesn't make sense to me, and I'm having a hard time imagining a scenario where this would be appropriate. Perhaps you could enlighten us.

2
  • Thanks for that @davidalger. Sure I would be happy to enlighten you on whats happening. Our client wants a UK (Northern Ireland) and ROI (Republic of Ireland) website with the same products but the ROI products are more expensive and in euro. The client doesn't want ROI or UK customers shipping to either countries for legal reasons. If you are in ROI you must purchase through the ROI website and likewise for the UK. The customer wants to share the cart so the customer switches and they dont have to choose products again. It is quite complicated, I hope this makes sense. Jan 31, 2013 at 15:51
  • 1
    Gotcha. Makes things a bit clearer, yes, but complicated as you say! :) Would yo perhaps be able to, instead of sharing the cart, have things setup so that when they switch to the other website, the cart is removed from one website and the products available on the website which were in the cart added to the cart? Not quite the same as shared cart, but achieves the goal of not having to select the products again.
    – davidalger
    Jan 31, 2013 at 18:38
7

I wrote an article here that worked for me for sharing the cart between websites. Full code provided.
The main idea is to change the session key that holds the quote id and to change the store views that share the quote. By default Magento remembers the quote id in $_SESSION['quote_id_{Store id here}']. (check Mage_Checkout_Model_Session::_getQuoteIdKey) That should be changed to $_SESSION['quote_id'].
The store view that share the cart need to be change from all the store views under a website to all store views. Check Mage_Sales_Model_Quote::getSharedStoreIds

4
  • Thanks for that, the others seem to want to quote what magento cannot do, like magento determines use cases, thanks again! Oct 18, 2015 at 18:34
  • Life saver!! Works for Magento 2 if you mess with the correct files
    – LefterisL
    May 11, 2017 at 14:20
  • @TerisL. OMG. I didn't expect that. Thanks for the heads up.
    – Marius
    May 11, 2017 at 14:49
  • np. Only issue i haven't solved yet, in Mage 2 it gets the QuoteKeyId by using a protected function inside the Mage\Session\Model\Session. Any ideas on how to override that ? Plugins doesn't seem to work for protected.
    – LefterisL
    May 11, 2017 at 19:26
3

There are three general scopes in Magento:

Website

This where you can have different websites (or businesses), like awesome.com and horrible.com.

Products from one website do not mix (are not shared) in the same cart as products from another site.

Stores

This is where you can have sub-brands or multiple brands under one roof, for example: houses.awesome.com, cars.awesome.com.

Technically you can probably have both awesome.com and horrible.com point to different stores under the same website, but it would probably defeat the whole purpose.

All products from each store are shared in one shopping cart (but not all products will be 'editable' in cart)

Store Views

This is where the same domain links to multiple variations, for example: having and english version of awesome.com, as well as a spanish version of awesome.com.

Another way store views can be used: different customers get different experiences.

All products mix and are editable in one shopping cart.

Summary

It sounds like you need to use multiple stores under one website to achieve your result.

For more info on this subject see here and here.

Your Answer

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

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