Question

I would like to display products with prices including taxes based on customer location. my idea is to display those prices based on customer geolocation even if the customer is not logged and never change to another store.

@FabianBlechschmidt wrote: the customer entity doesn't have a country, the customer has an address, which has a country and all taxes calculation are done with that information.

does anyone know a way to pass that information in order to display prices including taxes for a particular country, even if a customer is not logged. ideas or plugin welcome. brgds!

Was it helpful?

Solution

What you can do is to get the language from the Accept-Language header and the IP address. based on this information you can guess where the customer is and then open a popup or notice to inform the customer and give him the choice to change this. Then you add this information to the quote and your problem should be solved.

// get addresses and set country
Mage::getSingletion('checkout/cart')->getQuote()->getBillingAddress()->setCountryId('DE')->save();
Mage::getSingletion('checkout/cart')->getQuote()->getShippingAddress()->setCountryId('DE')->save();

maybe there is no address yet, then you have to create them and set them.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top