Collapse Menu
Docs Home
Extensibility Options
Contact Support

Limiting Product Availability by Country

Overview

In some situations, you may want or need to limit the availability of certain specific products in certain countries. This article shows you how to configure those limitations.

Overview

In some situations, you may want or need to limit the availability of certain specific products in certain countries. For example, contractual distribution rights, export restrictions, or risk concerns may motivate you to prevent customers in a certain country or countries from purchasing licenses for one or more of your products.

 

You can prevent a given product from being purchased in specific countries by excluding the countries using custom product attributes. When one of the specified countries is selected for an order - either based on the geographical location of the customer's IP address, or by selecting a specific country using the Countries and Currencies selector - products that exclude that country will not be displayed, and will automatically be removed from the order selected prior to initiating the checkout (e.g. in a Popup Storefront).

 

 

Customer Experience Examples

For example, suppose the example product Furious Falcon has a product attribute that excludes the United Kingdom. Customers in other parts of the world will not be affected, and will be able to purchase the product, as in the example below:

User-added image

At the same time, customers in the United Kingdom would not be able to see or select the product at all. Here is an example of the same exact product's page with the United Kingdom selected:

User-added image

To continue the example, if using a Popup Storefront, the checkout window will appear similar to this:

User-added image

 

To Configure Country Exclusions via Dashboard

  1. From the Dashboard, select the Products menu and then select Products, Bundles or Subscriptions, depending on the item type you want to configure.
  2. From the list of products, bundles or subscriptions, click the product's card to drill into the product details.
  3. In the product's details, click the MORE command and then select Product Attributes from the drop-down selector.

  4. In the Custom Attributes (Advanced) dialog, enter the word conditions in the Key field.
  5. In Value field corresponding to the the conditions key, enter a JSON object that specifies the countries to be included or excluded.
    1. If you want to allow the product to be purchased in all locations except for the named countries, exclude the countries where you do not want to sell the product.
    2. If you want to allow the product to be purchased only in certain countries, include the countries where the product can be sold.
    3. The contents of the object must consist of either the word exclude or include, followed by the word countries and an array of allowed or disallowed countries. The countries must be specified using the ISO 2-character country codes, and the entire object must be correctly formed JSON or else it will be ignored and no limitations will be enforced.

       Example 1: Valid JSON to exclude two specific countries

      {exclude:{countries:['AT','GB']}}

       Example 2: Valid JSON excluding all countries except the United States

      {"include":{"countries":["US"]}}

       Note

      If you pass both "include" and "exclude" values for the same country, "include" takes priority and "exclude" will be ignored.


      User-added image
       

  6. Click SAVE to save your changes.

 

To Configure Country Exclusions via the /Products API Endpoint

When creating or updating a product via the /products endpoint of the FastSpring API, use the product-level attributes field to pass in the exclusion data.

  1. For the first key string, pass conditions.
  2. For the corresponding value string, pass  a JSON object that specifies the countries to be included or excluded.
    1. If you want to allow the product to be purchased in all locations except for the named countries, exclude the countries where you do not want to sell the product.
    2. If you want to allow the product to be purchased only in certain countries, include the countries where the product can be sold.
    3. The contents of the object must consist of either the word exclude or include, followed by the word countries and an array of allowed or disallowed countries. The countries must be specified using the ISO 2-character country codes, and the entire object must be correctly formed JSON or else it will be ignored and no limitations will be enforced.

      Example 1: Updating a product to exclude two specific countries
      {
          "products": [
      	    {
      		    "product": "falcon",
      			"attributes": {
      			    "conditions":"{exclude:{countries:['AT','GB']}}"
      			}
          	}
      	]
      }
      Example 2: Updating a product to exclude all countries except one
      {
          "products": [
      	    {
      		    "product": "falcon",
      			"attributes": {
      			    "conditions":"{include:{countries:['US']}}"
      			}
          	}
      	]
      }    

       Note

      If you pass both "include" and "exclude" values for the same country, "include" takes priority and "exclude" will be ignored.

Try FastSpring

Get a free account and see why FastSpring is the ecommerce partner of choice for software providers around the world. Try our full-service ecommerce solution today to unlock revenue growth for your online company.