Today’s rising customer expectations put significant strain on Shopify merchants to keep up with major players like Amazon. 94% of customers blame merchants if a delivery goes poorly, even when it’s the customer that’s made a mistake. In fact, 20% of addresses entered online contain mistakes that contribute to $20 billion in lost packages every year. As a Shopify merchant, you need to ensure you’re able to proactively handle addresses that are undeliverable without disrupting your customer experience. Leverage Lob Address Verification for Shopify to verify and cleanse your customer address data, increase deliverability, and minimize unnecessary delays.
- Verify US Addresses for up to 250 of your most recent unfulfilled Shopify Orders
- Output report will identify orders with addresses that may need to be corrected
- Minimal knowledge of Python required
- Look out for our upcoming article about how to use Lob to verify your Shopify orders automatically with Zapier (coming soon)
Here is a brief tutorial about how to configure and execute a Python script that will verify the US shipping addresses for up to 250 of your most recent unfulfilled Shopify orders. You can modify the script to retrieve more Shopify orders, but the intention here was to provide you with a simple tool for validating your open orders and to optimize the shipping address for deliverability. The report will only contain order information for those orders that would require you to confirm the shipping address with the customer and update the orders in your fulfillment solution.
The output CSV file will contain the following for any order whose shipping address does not return as deliverable:
- order timestamp
- order id
- deliverability status
- shipping contact name
- shipping address
- an explanation as to why the address is not deliverable
For more information about deliverability as it pertains to US address verifications, please see:
How to Use Lob Address Verification For Shopify
1. Open your Shopify store’s admin page and navigate to Apps. Click on Manage private apps and Create a new private app.
You will need your API key and Password for the script to run. This private app only requires the default Read Access permissions.
Please see the Shopify Help Center article for more information regarding private apps.
2. Go to the Lob Dashboard and Sign In or Register for an account. In your account Settings, navigate to the API Keys tab. You will need your Live Environment API key for the script to run. We encourage you to use a secret key for maximum security.
3. Download or copy the Python script and open with a text editor.
You will need to enter the hostname of your Shopify account and paste your credentials inside the quotation marks.
shopify_hostname = “example.myshopify.com”
shopify_api_key = “Shopify_Private_app_API_key”
shopify_password = “Shopify_Private_app_Password”
lob_api_key = “Lob_Live_Environment_API_Key”
Save your plain text file as shopify_av.py to a local directory.
4. Open Terminal (Mac/Linux) and navigate to the directory where you saved the Python script.
Ensure that you have Python 3 installed:
$ python3 –version
Visit https://www.python.org/ for more information and to download the latest version.
Execute the script:
$ python3 ./shopify_av.py
Once the script has completed running, you will now notice there is a lob_address_verification.csv file in the directory where you executed the script. You can open this file as a spreadsheet to identify those orders that may require your attention. When you execute the address verification for Shopify script again, it will overwrite this file with more recent data.
With your Lob account, you can execute up to 300 US address verifications per month for free! For more information about higher-volume and International plans, or guidance on how we can help you with a more robust solution, please see our Address Verification page and contact our sales team.
At the time of publishing this article, the versions are:
- Shopify API 2019-10
- Lob API 2019-06-01
- Python 3.74
This article is intended to illustrate how these tools can be used together and is not a supported Lob feature. It was developed using the API versions listed above. As products evolve, the code may need to be adjusted to continue working correctly.