2

I need to have different prices for same products based on country. I was advised to use Price list module and to have different store per each country and I did that.

I.e. I have Swiss store and Serbian store. For Swiss store for supported billing countries I selected only Switzerland and for Serbian store only Serbia.

Swiss is default one and prices in product variations are defined in CHF. Now I'm trying to override prices for Serbian store (in RSD).

So, I created Serbian price list and added alternative prices for products. Problem is that those alternative prices are used only if I include also Swiss store for that Serbian price list (so price list is active also for Swiss store). If I select only Serbian store, as it suppose to be, then price list is not used (I see default prices in CHF).

I read here: https://drupalcommerce.org/blog/42419/commerce-2x-stories-stores

.. that stores are actually representing billing locations. But that confuses me because product and their prices are displayed before customer enters billing address?!?

What I'm missing here? Why Serbian store is not automatically active if I'm testing from Serbia? Do I need some GEO IP module or something? Even when I'm testing as a logged user (location entered before) I still use default Swiss store instead of local Serbian store.

1

Configuring the stores is one thing, determining which one is used for any given page request is another. One store is configured to be your default, and absent any other code, that store will always be used for the current page request, influencing visible products, pricing, carts, etc. If you want to make the current store something other than the default, you have to write a store resolver.

An example module you can reference is the Commerce Store Domain module, which resolves the current store based on the current domain. You can do something similar using the GeoIP module. I'm not aware of any existing contrib that integrates that as of yet.

1
  • I also found my self this Store Domain module and came to the same idea, but was surprised that there are no bunch of existing modules for switching stores depending on different conditions. Or something like Context module... Hopefully they'll appear.
    – MilanG
    Jul 9 '20 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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