Magento – How to assign customer group automatically based on address information

customergroupmagento-1.9module

How to assign customer group automatically following by address information

When customer register on our website, customer write the country where they live.
If customer live in United State, we would set the standard group(just default group).
If not like live in Jamaica, Spain, we'd like to assign to international group automatically.

So, it would show like this,
enter image description here

It seems like if-else statement on any languages but i didn't touch the code because i fix it myself one by one.

How can i do it?
app/code/core/Mage/Customer/Model
have the information about that i guess.

Best Answer

Not sure what you're trying to get at here, but this sounds like something Customer Segments would be useful for here. You can create a segment which looks at the "Country" of the "Customer Address" to find a match. You'd create one segment for each country (or groups of countries) you want. The segment is updated automatically. You can then use the segment in price rules or whatever you want.

If you can describe what your end goal is with putting users in different groups based on country, a better solution may be provided.

Edit: Based on his comment, here's how to do that.

Log in to your admin and go to Customer --> Customer Segments and click "Add Segment". Then fill in the information and click "Save and Continue Edit". Then click the "Conditions" tab and follow along.

  1. Click the green "(+)" icon and choose "Customer Address" from the dropdown. Select "Customer Address"
  2. From the new menu, select "Country". Select "Country"
  3. And finally select the single country you want. enter image description here
  4. To have it be a group of countries (like all of United Kingdom) click on the "ALL" in the sentence If Customer Addresses match ALL of these Conditions

When you save, you can view the tab "Matched Customers" and see who all is included in these conditions.

Since these are dynamic groups, they change all the time and you can adjust the conditions as necessary to get the correct grouping you want. You can also export the results easily from the "Matched Customers" tab.

Related Topic