How to Sync your Inventory from Square POS to Wix
Who is our client and what problem did they want to solve?
Our client owns a store that sells disc golf products from their physical store and on-demand at different events.
They needed a way to sync inventory levels between products sold in their brick-and-mortar store through their Square Point of Sales system to their product inventory in Wix.
What solution did we provide?
To do this, we imported their products from Wix into Square, then took the resulting catalog and imported it into a content manager database containing the Square Product ID, the Wix Inventory Item ID, and the Wix Product ID. Then we created a webhook within Square to send data to the Wix site whenever inventory was updated within Square.

What is a webhook?
Webhooks are a service many software providers offer to allow for custom integrations. Essentially, when a specific event happens in their system, they send the data from that event to a URL you provide where you can have code set to receive data from that URL.
For this specific client, whenever the webhook fires, it tells us which Square product has an inventory update and we can look it up in the content manager database to find out which Wix Product it correlates to and then use the 'incrementInventory' or 'decrementInventory' API from the 'wix-stores-backend' module to make the inventory adjustment.
Check out the code we used below:
import { ok, badRequest } from 'wix-http-functions';
import wixData from 'wix-data';
import wixStoresBackend from 'wix-stores-backend';
export async function post_inventoryUpdate(request) {
const body = await request.body.json();
const objectData = body.data.object.inventory_counts[0];
const squareId = objectData.catalog_object_id;
const quantity = objectData.quantity;
const squareProduct = await wixData.query("SquareProducts").eq("squareId", squareId).find({ suppressAuth: true }).then(results => results.items[0]).catch(err => err);
const wixProduct = await wixData.query("Stores/Products").eq("_id", squareProduct.productId).find({ suppressAuth: true }).then(results => results.items[0]).catch(err => err);
const amountToChange = Math.abs(quantity - wixProduct.quantityInStock);
if (quantity > wixProduct.quantityInStock) {
// increment inventory
console.log("Incrementing inventory");
const incrementInfo = { productId: squareProduct.productId, variantId: squareProduct.variantId, incrementBy: amountToChange, inventoryId: squareProduct.inventoryId }
wixStoresBackend.incrementInventory([incrementInfo]).then(() => {
console.log("Inventory incremented by " + amountToChange)
return ok();
}).catch(err => console.log(err));;
} else {
// decrement inventory
console.log("Decrementing inventory");
const decrementInfo = { productId: squareProduct.productId, variantId: squareProduct.variantId, decrementBy: amountToChange, inventoryId: squareProduct.inventoryId }
wixStoresBackend.decrementInventory([decrementInfo]).then(() => {
console.log("Inventory decremented by " + amountToChange)
return ok();
}).catch(err => console.log(err));
}
return badRequest({body: 'Invalid request'});
}
Need help syncing your inventory or something else? Contact us at 225-250-1888 or email robert@roberthebertmedia.com.
About our company
RHM specializes in helping businesses of all sizes and across all industries achieve their digital and web marketing needs. Whether you are designing a new website, building an app, performing custom development, or running Google Ads, our goal is to showcase how you are the best at what you do and help people connect with you. Contact us at 225-250-1888 to get started!



Đồng bộ tồn kho giữa Square POS và Wix nghe như một việc nhỏ nhưng dễ gây rối nếu số lượng hàng ở hai nơi không khớp. Bài viết khiến tôi nghĩ đến những lần đọc hướng dẫn kỹ thuật mà chỉ cần một bước chưa rõ là mất mạch ngay. Trong một cuộc trò chuyện rảnh rỗi trước đây, tôi từng nghe nhắc SUNWIN như một tên trong lĩnh vực game bài đổi thưởng, nhưng bản thân chưa sử dụng hay biết thêm thông tin. Liên hệ đó không giúp giải quyết chuyện tồn kho, chỉ làm tôi nghĩ rằng các quy trình khác nhau đều cần được giải thích theo thứ tự dễ theo dõi.
Bài viết giải thích khá rõ luồng chuyển dữ https://sunwinplus99.com.co liệu hàng tồn kho từ Square POS sang Wix, nhất là việc cần giữ thông tin sản phẩm đồng nhất giữa hệ thống bán hàng và cửa hàng trực tuyến. Tôi vừa đọc xong nên vẫn còn muốn xem thêm cách xử lý khi tên hoặc mã sản phẩm ở hai bên không khớp, vì đó có vẻ là chỗ dễ phát sinh nhầm lẫn. Nhìn chung, phần hướng dẫn giúp tôi hình dung được các bước chính, dù tôi chưa có dịp tự làm quy trình này.
Bài về đồng bộ tồn kho từ Square sang Wix đọc hơi khô, nhưng có chỗ làm tôi nhớ chuyện của mình. Đại ý là số liệu hai bên phải khớp, lệch một cái là rối cả buổi, sửa chỗ này lại hỏng chỗ kia. Tôi không bán hàng, nhưng cái cảm giác đếm đi đếm lại vẫn không ra cùng một con số thì quen lắm, cứ như ngồi kiểm lại sổ mà mãi không yên tâm. Hôm trước thằng em họ qua nhà, nó ngồi kể về mấy trang game bài đổi thưởng, tiện miệng nhắc https://sunwinhub247.co, tôi nghe mà trong đầu vẫn đang nghĩ chuyện khác. Đọc xong bài này mới thấy việc đồng bộ nghe đơn…
Thinking about creating welcoming community activities, I find the smaller practical questions more interesting than a quick conclusion. A small shared activity can help people contribute without needing to know everyone in advance. With Bramptonlocal in mind, community participation ideas feels like a topic worth exploring one question at a time. I can imagine different responses depending on the situation, which makes the question more interesting. What would make an invitation easier for a newcomer to accept?
What interests me about finding the character of a local meeting place is how a broad idea becomes part of an ordinary day. An ordinary conversation can become part of the reason people remember a place. For Anchor Pub, I would use local pub culture as a starting point for a closer discussion of the subject. It leaves me curious about the steps between understanding an idea and putting it into practice. What makes a local meeting spot feel welcoming to a first-time visitor?