Collapse Menu
Docs Home
Extensibility Options
Contact Support

Limiting Product Availability by Country

Overview

This article explains how you can prevent the purchase of specific products by customers in specific countries.

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 specific country or countries from purchasing 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 the customer's country is one of the specified countries, products that exclude that country do not appear on a Web Storefront. If the customer changes the order country after selecting such a product, FastSpring automatically removes the product from the order.

 

Customer Experience Examples

For example, suppose Example Product 1 has a product attribute that excludes the United Kingdom. Customers in other parts of the world are not affected; they can purchase the product, as in the example below:

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 product's page with the United Kingdom selected:

To continue the example, suppose your page uses a Popup Storefront and a customer changes the order country to one you have excluded for the product. In that case, the checkout window would appear similar to this:

 

 

To Configure Country Exclusions via the FastSpring App

  1. In the FastSpring App, select the Products menu and then select ProductsBundles, or Subscriptions, depending on the item type you want to configure.
  2. From the list of products, bundles, or subscriptions, select the product you want to configure.
  3. In the product's details, click Options at the top right-hand corner and then select Custom Attributes from the drop-down selector.


     
  4. In the Custom Attributes (Advanced) dialog, enter the word conditions in the Key field.
  5. In the Value field corresponding to the conditions key, enter a JSON object that specifies the countries to include or exclude.
    • If you want to allow customers to purchase the product in all locations except for the named countries, exclude the countries where you do not want to sell the product.
    • If you want to allow the product to be purchased only in certain countries, include the countries where the product can be sold.
  6. 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. The entire object must be correctly formed JSON, or else your Store ignores it and does not enforce any limitations.

     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" is ignored.


     
  7. 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 you want to include or exclude.
    • If you want the product to be available in all locations except for the named countries, exclude the countries where you do not want to sell the product.
    • If you want to allow the product to be purchased only in certain countries, include the countries where the product can be sold.
    • 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. The entire object must be correctly formed JSON, or else your Store ignores it and does not enforce any limitations.
     
    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" is 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.