A Custom Connector can be created for the NetSuite – Shopify Integration using Suitescript 2.1.
Shopify is an eCommerce platform that hosts your online store. It helps organize the layout of your store’s appearance through themes (which you’re free to modify or change any way you want). It also offers payment processing, which allows you to accept and receive payment for the products you sell. Basically, Shopify offers an Online store where the User can sell the products.
NetSuite is a Cloud-based System that enables companies to manage all key business processes in a single system. Companies use NetSuite for enterprise resource planning (ERP), manage inventory, track their financials, host e-commerce stores, and maintain customer relationship management (CRM) systems.
A NetSuite can act as a backend for the Shopify stores. A custom connector syncs the date between the NetSuite and Shopify so you can automate processes such as order fulfillment, inventory count updates, pricing updates, financial reporting, and much more. The NetSuite-Shopify integration saves time and money.
Basically, we can do integration in three ways:
- Point to Point Integration
- Custom Shopify and NetSuite Integation
- Saas-Based Middleware Integration Platform
We have successfully implemented the Custom Shopify and NetSuite Integration. This type of integration is implemented using the APIs of both Shopify and NetSuite.
The first step for developing the custom NetSuite-Shopify connector is to define the scope of the business. Custom integration takes serious technical knowledge of both NetSuite and Shopify to understand how each system sends and reads data. The scope can be confirmed based on the Client’s business and the requests.
Define all the field mappings between NetSuite and Shopify before the development. This will be helpful for the development also for the clients.
If you want to use the Shopify API, we need to first create the Shopify private app in the store account. On the creation of the private app, the credentials will be generated. A custom record should be created and store the generated credentials as a custom record entry. This custom record can be used for all the connector scripts for fetching the Shopify credentials. This will helps in the future if the credentials are changed, we need to update only on the custom record. the For creating the Shopify app, we need to do the following steps:
From your Shopify admin, go to Apps. Click Manage private apps, near the bottom of the page. Click Create a new private app. In the App details section, enter a name for the private app and a contact email address.
Following are the scopes we have successfully implemented for the custom Connector:
- Item Sync
- Stock Update SYNC
- Customer SYNC
- Order SYNC
- Item Fulfillment SYNC
- Cash Refund SYNC
ITEM SYNC
Item SYNC is challenging work because how NetSuite uses product data is fundamentally different than how Shopify uses it. NetSuite provides different item types(eg: inventory items, matrix items, kit items, assembly items, etc) but Shopify doesn’t provide that flexibility. The inventory setup of Shopify is a product and its variants.
For the Kit items, the component details can be stored in the Shopify Product Description.
The images can be synced to Shopify. We can use the URL of the image for syncing. But make sure that the Available Without Login for the file image is checked.
We can map the inventory item, kit items, and assembly items as products in Shopify. We can use the product API for product creation. When a product is created, a default variant will also be created automatically. It is better to store the product id and product variant id in the Netsuite item record. Also, the Shopify SKU should be stored from the Netsuite. So it is better to store the Shopify unique id in the NetSuite and false store the NetSuite unique id in the Shopify.

NetSuite matrix items can also be mapped to Shopify. We can store the matrix parent item as the Shopify product and matrix child items as the product variants in Shopify. In the parent matrix item, store the Shopify product id. And for the matrix child items, store Shopify product id and variant id. For the creation of product and product variants, Shopify Product API is preferred to use. If we use the Shopify Product Variant API for the creation of variants, we need to use the extra API call for the inventory adjustment. The Product API will allow setting the quantity directly.
POST /admin/api/2021-07/products.json
PUT /admin/api/2021-07/products/{product_id}.json
DELETE /admin/api/2021-07/products/{product_id}.json
From my Shopify Development experience, matrix items creation cannot be done in real-time. Please use the map-reduce/scheduled script for the matrix items creation. Update/deletion of matrix items can be done in real-time. The inventory items, kit items, and assembly items can be created/updated/deleted in real-time
Multiple price level is not supported in the Shopify directly. The multiple price level can be handled using plugin/Shopify plus.
Stock Update SYNC
The stock update needs to be done periodically for syncing the inventory quantity to Shopify. In Netsuite, the following records need to be considered since those records will affect the item inventory in NetSuite.
- Inventory Adjustment
- Itemreceipt
- Creditmemo
- vendorbill
- Invoice
- Vendorcredit
- Itemfulfillment
- inventorytransfer
- Cashsale
- Cashrefund
- Sales order
A common script should be created/developed and should be deployed for all the above-mentioned records.
If the record is edited and changes the item quantity the updated items will be updated in Shopify. If the record is created, all the items in the record will be updated in Shopify. If the item is an inventory item and component of any kit items then the kit items related to this item will also be updated in Shopify. If the item is a kit item, then this kit item’s components will also be updated in Shopify. The delete context of the records other than the item fulfillment, sales order, and item receipt will not be considered for stock update. The close action and the related inventory change in the items of the sales order will not be considered.
The stock update can be done in real-time
Customer SYNC
The Customer can be directly synced to Shopify when a Customer is created/updated/deleted. Shopify provides the direct API for customer sync. The Shopify customer id should be stored in a custom field of the Netsuite customer record. For the Shopify. email and phone numbers are not mandatory for Customer creation. But it is better to use the email id as a unique key from the NetSuite but it can be changed based on the client requirements.
POST /admin/api/2021-07/customers.json
PUT /admin/api/2021-07/customers/{customer_id}.json
DELETE /admin/api/2021-07/customers/{customer_id}.json
The Customer SYNC can be done in real-time
Order SYNC
The customer will place the orders periodically in Shopify. In Shopify, Orders can be placed through the different sales channels. The different sales channels can be created for the Shopify and following the most common sales channels:
- Online Store
- POS
Shopify Order API is directly available for the connector sync. A map-reduce script can be used to sync the orders from Shopify. The script will sync the order periodically and so only the recent orders need to consider for the sync. This can be done by adding the updated_at_min parameter so this will ensure only the recent orders will be considered when order API is called.
GET /admin/api/2021-07/orders.json?status=any
A custom record is created for storing each order’s API call details. For each order from the Shopify, a custom record entry is created.
For the Order SYNC, the connector needs to find the customer in the NetSuite. Fetching of customers can be done using the Shopify customer id which is stored already while customer sync. IF no customer is found, then the connector will create a new customer. The created/fetched customer will be stored in the corresponding custom record.
After the customer fetching, the connector will be created sales order/cash sales/invoice based on the client requests. The created sales order/cash sale/invoice should be stored in the corresponding custom record. The payment methods, shipment methods, and discount items should be considered while developing the order sync. We need to create the payment methods, shipment methods, and discount items in NetSuite and Shopify as an initial setup. It would be preferred those names should same on both Shopify and NetSuite.
The connector can send a response to Shopify on the successful/unsuccessful creation of the orders in the Netsuite. The response can be stored in the tags of the Shopify orders.

If an error has occurred during the order sync process, the connector needs to store the error details in the custom record.
A sample structure of the custom record is given below:

Basically using the custom record, the Client can check the overall status of the Shopify Order SYNC. This setup will help the user to create the saved search for the successful orders and unsuccessful orders.
Item Fulfillment SYNC
When an item fulfillment is created for the Shopify orders in the Netsuite, then the connector needs to acknowledge the Shopify that the order is fulfilled. For that, we need to use the following API
POST /admin/api/2021-07/orders/{order_id}/fulfillments.json
In the Body of the API call, we need to specify Location id, Line item, Line Quantity.
On the successful API Call, Shopify will automatically set the status of the Order based on the item and item quantity.
The fulfillment order id should be stored in the corresponding item fulfillment record. The item fulfillment id will be stored in the corresponding custom record.
Real-Time SYNC is supported
Cash Refund SYNC
When a cash refund is initiated for the Shopify order in the NetSuite, then the same refund needs to be done to Shopify.
Following are the steps for the Cash refund in NetSuite:
The user creates a return authorization from a Shopify order in Netsuite. And then creates an item receipt and cash refund from that. So when a user creates a cash refund in Netsuite, the Connector needs to send the cash refund API to Shopify that the order is refunded.
For the cash refund, first, need to calculate the cash refund and then based on that the cash refund. Both have API and the connector needs to make the API call.
POST /admin/api/2021-07/orders/{order_id}/refunds/calculate.json
POST /admin/api/2021-07/orders/{order_id}/refunds.json
In NetSuite, the cash refund is process is completing after the successful creation of the different records. So need to consider those records for the cash refunding process SYNC. The cash refund id will be stored in the corresponding custom record.
Real-Time SYNC
TAX setup
On Shopify, there are two ways of tax:
- Tax is inclusive in the product price
- Tax is exclusive in the product price
If the tax is inclusive, we can do the following setup for the item sync:
Consider a Shopify product item price is 10.00
On the NetSuite Side, the item price will be exclusive of the VAT, and for Shopify, the price will be inclusive of the VAT which will be done by the connector. Based on the mentioned example, the price in the NetSuite will be 7.70(10 – 2.30) and for the Shopify side, the price will be 10.00.
When the sales order is created for the same Shopify order, then the amount will be 7.70 and the tax amount will be 2.30 and thus gross amount will be 10.00.
So this way amount of the orders will match each other in both NetSuite and Shopify.