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 Answer 1

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.

4
  • 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, 2020 at 13:38
  • @MilanG did you find a solution on this? I have the same issue right now.
    – Asme Just
    Dec 10, 2022 at 4:02
  • @AsmeJust sorry it's been a while and I don't work any more on that project/company. Anyway, I do remember that I used GeoIP for detecting user's location.
    – MilanG
    Dec 12, 2022 at 10:57
  • Thanks for the response.
    – Asme Just
    Dec 12, 2022 at 22:41

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.