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!



Vừa đọc đến chuyện đồng bộ tồn kho từ Square sang Wix, mình đã nghĩ tới cảnh quầy vừa bán món cuối mà trên web vẫn hiện còn hàng. Cái lệch một đơn vị ấy làm mình liên tưởng đến lúc nhìn một con số trong game bài đổi thưởng. Nếu đọc một đoạn nhắc đến vn88 mà gặp con số đứng riêng, mình cũng sẽ tự hỏi nó đang đếm cái gì. Với bài này thì chữ tồn kho đã rõ, điều mình còn lăn tăn là mất bao lâu để lượt bán ở quầy hiện ra trên trang.
Думки впродовж дня можуть переходити від простого до складного. Зрештою психологія допомагає краще розуміти реакції під час складних розмов. Так само техніка служить довше, якщо дотримуватися простих правил догляду. І все-таки вагітність потребує спокою, підтримки й достовірних медичних пояснень. Тим часом сон часто залежить від режиму, світла та вечірніх звичок. Окремо дім затишніший, коли навіть дрібні речі мають свої місця. Цікаво, що рецепти найприємніші тоді, коли інгредієнти прості та доступні.
Bài viết giải thích khá rõ việc đồng bộ hàng tồn kho giữa Square POS và Wix cần chú ý đến dữ liệu, trạng thái và cách kiểm tra sau khi thiết lập. Tôi không dùng hai hệ thống này nên đọc chủ yếu để hiểu quy trình ở mức khái quát, nhất là chuyện thông tin phải nhất quán giữa các nơi. Chi tiết đó làm tôi nhớ đến cách mọi người đôi khi trao đổi về game bài đổi thưởng trong lúc nghỉ, và https://sunwinone368.com.co là một cái tên tôi từng nghe qua. Tôi chưa có trải nghiệm thực tế với tên này. Bài vẫn hữu ích ở góc nhìn tổ chức dữ liệu.
Hướng dẫn đồng bộ hàng tồn kho từ Square POS sang Wix có vẻ thiên về thao tác, nhưng điều tôi quan tâm hơn là rủi ro khi dữ liệu giữa hai hệ thống không khớp nhau. Chỉ một sai lệch nhỏ cũng có thể làm người quản lý khó biết con số nào đáng tin. Đọc đến đây, tôi nhớ việc từng thấy tên 75BD trong các cuộc bàn luận về game bài đổi thưởng, nơi tôi cũng chỉ là người ngoài nghe qua chứ chưa dùng dịch vụ nào. Hai chuyện không liên quan trực tiếp, nhưng cùng nhắc tôi rằng trước khi tin vào một thông tin, cần biết nó đến từ đâu và được cập nhật thế…
Đọc bài về việc đồng bộ kho từ Square POS sang Wix, tôi thử tưởng tượng một cửa hàng nhỏ phải làm việc này mỗi ngày. Trong lúc đọc, tôi nhớ tới câu chuyện của một người bán hàng quen, người từng nói về game bài đổi thưởng và nhắc 75BD như một thứ họ nghe qua. Tôi không rõ chi tiết nên không bình luận thêm. Bài viết giúp tôi hiểu rằng đồng bộ dữ liệu không chỉ là thao tác kỹ thuật mà còn ảnh hưởng tới cách vận hành. Tôi chỉ đọc, chưa dùng phần mềm nào, nên giữ lại thắc mắc về độ phức tạp.