Installing the what3words Address Field Plugin for WooCommerce

easy

The what3words WooCommerce app allows a what3words address field to be added to the checkout page of a WooCommerce store. This enables customers to provide a what3words address with orders for faster and more reliable deliveries.

WordPress Minimum Supported Version: 4.7 or higher

pdf icon Arabic version

1Get an API Key
Signup to create key
2Installing the what3words plugin for WooCommerce

Go to your WordPress Dashboard, select Plugins, click Add New then search for what3words.

Click Install and then Activate.

Get the app

3Locate the app

Find the what3words app in your Plugins list and click Settings.

4Add your API key

Copy in the API key you created earlier and press Save.

5Under <b>Settings</b>, make sure<b> Add what3words address field to my checkout for me</b> is selected and press <b>Save</b>.

Under Settings, make sure Add what3words address field to my checkout for me is selected and press Save.

6Troubleshooting

If you are using the Free plan and have enabled the save coordinates feature in your plugin settings, you are making convert-to-coordinate requests, which are not supported under the Free plan. You might encounter the following errors:

  • You should see an error similar to Transport error under the what3words address field at the checkout page.
  • In the network panel, look for Error 402: Payment Required. The response to this error is:

{
    "error": {
        "code": "QuotaExceeded",
        "message": "Quota Exceeded. Please upgrade your usage plan, or contact support@what3words.com"
    }
}
Copied

We are actively working on updating our plugins to prevent this error by disabling the save coordinates feature when the API key is registered under a Free plan.

For more information, visit our API plans page. If you need further assistance, contact support@what3words.com.

Additional Settings

Instead of letting the plugin create a field,  you can customise which field(s) to convert to a what3words Address Field by selecting Convert an existing field to a what3words Address Field option and providing selectors for the inputs to convert. You can use any DOM compliant query selector(s) here to specify a single or multiple fields that you wish to convert.

N.B. When using input selectors you should ensure each input field has a unique name attribute to ensure clashes do not occur if multiple what3words Address Fields appear on a single page.

If you want to add a new custom field to extend as a what3words Address Field you should first create an input field on the page you wish to add this functionality to and provide with a name, id and/or that can then use in the input selector to specify it. (Be careful when using classes as it can apply this behaviour to multiple fields.)

If you want to capture the selected what3words address you should wrap this field in a form with a submit button and this will then be submitted as specified by your form.

If you need to capture the coordinates for a three word address to help with delivery information, for example, you should check the Save coordinates checkbox.

If you have added the what3words Address Field to your WooCommerce checkout and you select Save coordinates the coordinates for the billing and shipping address fields will added to your order and visible in your Orders page on WooCommerce.

If you are using custom field(s) for the address then you the component will automatically attach hidden fields for both the latitude and longitude of the coordinates for the adddress prefixed with the name you supplied to the input field.

Note this uses an additional what3words API call to convert the what3words address to coordinates. Please ensure the tier you have signed up to covers the amount of usage you intend to do to avoid interruption of service.

For improved accessibility it is recommended that you add a label to your what3words Address Field. By checking this option and supplying some text for the label you can easily associate a label to each of your address field(s).

For WooCommerce customers this option allows you to override the default label associated to the address field(s), while for custom field users this option tells the plugin to create a label field for you.

You can override the default placeholder for the address field(s) by selecting this option and specifying the placeholder text. We recommed you use the default placeholder value as it provides your customers with an example of how to use the what3words Address Field.

We provide a number of options for clipping the autosuggest results, limiting the addresses that can be validated and captured. You can clip suggestions to a number of countries by providing comma separated 2 digit ISO codes for each country you wish to clip to. This will ensure suggestions provided are clipped within the countries specified. You can also clip within a circle, a bounding box or a polygon.

N.B. – When providing multiple clippings the overlap of the polygons is what forms the suggestions provided when using the what3words Address Field.

For WooCommerce checkouts we recommend skipping these options as the clip to country is automatically set when a user selects a country for their billing and/or shipping information as they select a country from the dropdown menu options in the checkout form.

When a what3words address is captured in this field, it will be saved within the order details and will be visible in the order preview and shipping label screens.

In WooCommerce, the what3words address attributes are stored in the customers’ orders of the WooCommerce Orders REST API as a meta_data field.

The API request to make to the WooCommerce Orders REST API should be:
GET {{your-wordpress-site}}/wp-json/wc/v3/orders

The API response should be:

"meta_data": [
  {
      "id": 606,
      "key": "_billing_w3w",
      "value": "///filled.count.slap"
  },
  {
      "id": 607,
      "key": "_billing_nearest_place",
      "value": "Wednesfield, W. Midlands"
  },
  {
      "id": 608,
      "key": "_billing_w3w_lat",
      "value": "52.599329"
  },
  {
      "id": 609,
      "key": "_billing_w3w_lng",
      "value": "-2.083533"
  },
  {
      "id": 610,
      "key": "_shipping_w3w",
      "value": "///filled.count.slap"
  },
  {
      "id": 611,
      "key": "_shipping_nearest_place",
      "value": "Wednesfield, W. Midlands"
  },
  {
      "id": 612,
      "key": "_shipping_w3w_lat",
      "value": "52.599329"
  },
  {
      "id": 613,
      "key": "_shipping_w3w_lng",
      "value": "-2.083533"
  },
  ...
],

Have any questions?

We’re here to support you! Get in touch with us by writing us an email at support@what3words.com.

Recommended WooCommerce tutorials

View all tutorials