Country State

Extension installation via composer for Magento 2.4.3

Latest Versions

Module

Version

Magento Commerce

(aka. OpenSource)

Adobe Commerce

(Adobe Commerce Cloud)

Adobe Commerce

(Adobe Commerce Cloud)

+ Native B2B extension

Module

Version

Magento Commerce

(aka. OpenSource)

Adobe Commerce

(Adobe Commerce Cloud)

Adobe Commerce

(Adobe Commerce Cloud)

+ Native B2B extension

tnw/sforcecountrystate

 

Installation/Upgrade Instructions

STEP 1 - Register new composer repository

Register PowerSync repository

NOTE: These steps are only necessary when installing our software for the first time

composer config repositories.powersync composer https://dist.powersync.biz

STEP 2 - Enable maintenance mode

bin/magento maintenance:enable

STEP 3 - Install the product via composer

composer require

tnw/sforcecountrystate=
--no-update

composer upgrade tnw/soap-client tnw/salesforce tnw/sforceenterprise tnw/sforcecustomergroup tnw/sforcetierprice tnw/sforcerma tnw/sforcequickorder tnw/sforcecountrystate

STEP 4 - Performing Magento upgrade

Re-save configuration pages after the upgrade

 

Extension installation via composer for Magento 2.4.4

Latest Versions

Module

Version

Magento Commerce

(aka. OpenSource)

Adobe Commerce

(Adobe Commerce Cloud)

Adobe Commerce

(Adobe Commerce Cloud)

+ Native B2B extension

Module

Version

Magento Commerce

(aka. OpenSource)

Adobe Commerce

(Adobe Commerce Cloud)

Adobe Commerce

(Adobe Commerce Cloud)

+ Native B2B extension

tnw/sforcecountrystate

 

Installation/Upgrade Instructions

STEP 1 - Register new composer repository

Register PowerSync repository

NOTE: These steps are only necessary when installing our software for the first time

composer config repositories.powersync composer https://dist.powersync.biz

STEP 2 - Enable maintenance mode

bin/magento maintenance:enable

STEP 3 - Install the product via composer

composer require

tnw/sforcecountrystate=
--no-update

composer upgrade tnw/soap-client tnw/salesforce tnw/sforceenterprise tnw/sforcecustomergroup tnw/sforcetierprice tnw/sforcerma tnw/sforcequickorder tnw/sforcecountrystate

STEP 4 - Performing Magento upgrade

Re-save configuration pages after the upgrade

 

Usage

Country State module provides you with the ability to import Countries and States from Salesforce to Magento

  • Go to Magento Admin panel - Salesforce - (Configuration) - Country State

Enable Update

The “Enable Update” option turns on/off the Country State module

To Enable Country State module

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • set “Enable Update“ option to “Yes

As a result, all Country State module options become available

Important: Also you need to start related consumers:

  • tnwCountryStateUpdateConsumerAmqp

  • tnwCountryStateUpdateConsumerDb

Follow the manage message queues documentation and add the following listeners to your /app/etc/env.php file.

To Disable Country State module

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • set “Enable Update“ option to “No

As a result, all Country State module options will be hidden.

Country State module Connection to Salesforce

Country State module requires connection to Salesforce. You need to upload Metadata WSDL file and then click the Test Connection & Apply Salesforce changes button

To get Metadata WSDL file:

  • Go to Salesforce - Gears button - Setup

  • Start typing “API“ word into the “Search Setup“ field

  • Click on the “API integration” item in the Search list

  • Click on Generate Metadata WSDL link and save page content to file

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • Click on the “Browse“ button and select the previously saved Metadate WSDL file

  • Click Save button

  • Click “Test Connection & Apply changes

Enable Automatic Update

The “Enable Automatic Update” option allows you to Enable/Disables Automatic Country State import. If disabled, the import still can be performed manually

To Enable Automatic Update

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • set “Enable Update“ option to “Yes

  • set “Enable Automatic Update” option to “Yes

Now you are able to set update frequency:

  • Select Start Time

  • Select Automatic Update Frequency - Daily, Weekly, or Monthly

To Disable Automatic Update

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • set “Enable Update“ option to “Yes

  • set “Enable Automatic Update” option to “No

Manual update

You have the ability to manually Initialize Countries and States picklist update at any time

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • Click the “Update Now“ button

Manage Countries page

On Manage Countries page you could view all countries created in the Magento database

  • go to Magneto Admin panel - Sidebar menu - Salesforce icon

By clicking on “Manage Regions“ action link you will be able to view all regions/states created for selecte country

Use Cases

Create new Country

For example, you need to create a new country that is not listed among default Magento countries. You need to do next:

  • Go to Salesforce - Click on Gears button - Setup

  • Start typing the “picklist“ word into the “Search Setup“ field

  • Click on the “State and Country/Territory Picklists Data” item in the Search list

  • Click on “The Configure States, Countries, and Territories“ link

  • Click the “New Country/Territory“ button

  • Fill in all required fields and click Add button

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • Click the “Update Now“ button

  • go to Magento Admin panel - Stores - Configuration - General - Country Options tab

  • Find the newly created country in Allow Countries list

  • check new country is available on Frontend

Create new States

In case when you need to create a new state for an existing country that is not listed among default Magento states. Do next:

Let try to add new states for Andorra

  • Go to Salesforce - Click on Gears button - Setup

  • Start typing the “picklist“ word into the “Search Setup“ field

  • Click on the “State and Country/Territory Picklists Data” item in the Search list

  • Click on “The Configure States, Countries, and Territories“ link

  • Click the “Edit” link near Andorra country

  • Click the “New State“ button

  • Fill in all required fields and click Add button

  • go to Magento Admin panel - Salesforce (sidebar menu) - Country State - Country State Configuration tab

  • Click the “Update Now“ button

  • Go to Magento Frontend and check new States are available for Andorra

  • Place order for new state and check synchronization with Salesforce

Related articles