WP e-Commerce shipping to USA and Canada only

After installing the WordPress WP e-Commerce shopping cart plugin, I needed to make a few modifications so the cart would work exactly the way I wanted. One of those changes involved restricting which countries customers could select for shipping.

If you run a small online business, you may not want to ship products worldwide. Limiting orders to specific countries can simplify logistics, reduce risk, and make shipping costs easier to manage.

In this tutorial, I will show you how to modify the WP e-Commerce shopping cart plugin so that only the countries you want to ship to appear in the checkout country list.

If you have already installed the shopping cart plugin, skip ahead to Section 2.

The Process

Section 1: Modify the Country List Before Installing the Plugin

First, download the latest version of the WP e-Commerce shopping cart plugin and extract the contents to your computer.

Next, browse to the wp-shopping-cart folder and open the file currency_list.php using a text or code editor. A lightweight editor such as Crimson Editor or the portable notepad++ works well for editing PHP files.

The currency_list.php file contains a list of all selectable countries that are inserted into the SQL database during installation. By editing this file, you can limit the country list to only those you plan to ship to.

Remove the lines that contain countries you do not want listed. Be sure to keep the beginning section:

<?php
$currency_sql="

And the closing section:

";

For example, here is a simplified list that only allows shipping to the United States and Canada:

<?php
$currency_sql="INSERT INTO `".$wpdb->prefix."currency_list` VALUES (136, 'USA', 'US', 'US Dollar', '$', '$', 'USD', '1', '');
INSERT INTO `".$wpdb->prefix."currency_list` VALUES (100, 'Canada', 'CA', 'Canadian Dollar', '$', '$', 'CAD', '1', '');";

Once your list includes only the countries you want to support:

  1. Save the currency_list.php file.
  2. Copy it back into the wp-shopping-cart folder.
  3. Upload the folder to your WordPress /wp-content/plugins/ directory.
  4. Activate the plugin from the WordPress Plugins menu.

Section 2: Remove Countries After the Plugin Is Installed

If the plugin is already installed and active, you can still remove countries directly from the database.

  1. Go to the WordPress Plugins section and temporarily disable the shopping cart plugin.
  2. Log in to your phpMyAdmin control panel.
  3. Select your WordPress database.
  4. Locate the table named currency_list (for example wp_currency_list).
  5. Browse the table and delete the rows for countries you do not want listed.
  6. Return to the WordPress Plugins page and reactivate the shopping cart plugin.

Once the plugin reloads, the checkout country list will only include the countries you left in the table.

Final Notes

Restricting the shipping country list can help prevent orders from locations you do not ship to and simplify international shipping management. This small customization can make the checkout process clearer for customers and reduce unnecessary order issues.

P.S. If you would like a copy of the currency_list.php file configured for US and Canada only, you can download it here:

Download the US and Canada currency_list.php file