Validate products fix
This commit is contained in:
@@ -44,24 +44,25 @@ const wProducts = await webflow.Products.list({ forceAll: true });
|
|||||||
|
|
||||||
let invalidCount = 0;
|
let invalidCount = 0;
|
||||||
for (const wProduct of wProducts) {
|
for (const wProduct of wProducts) {
|
||||||
for (const sku of wProduct.skus ?? []) {
|
for (const wSku of wProduct.skus ?? []) {
|
||||||
console.log("Webflow: " + sku.id, sku.fieldData.name);
|
console.log("Webflow: " + wSku.id, wSku.fieldData.name);
|
||||||
|
|
||||||
const pVariant = await printful.Products.Variants.get(`@${sku.id}`);
|
const pVariant = await printful.Products.Variants.get(`@${wSku.id}`);
|
||||||
if (pVariant) {
|
if (pVariant) {
|
||||||
console.log("Printful: " + pVariant.id, pVariant.name);
|
console.log("Printful: " + pVariant.id, pVariant.name);
|
||||||
|
const expectedColor = syncer.parseColorGroup(pVariant.name) ?? pVariant.color;
|
||||||
const validations = [
|
const validations = [
|
||||||
// validateEquality(sku.fieldData.name, pVariant.name),
|
// validateEquality(sku.fieldData.name, pVariant.name),
|
||||||
validateEquality(
|
validateEquality(
|
||||||
sku.fieldData["sku-values"]?.["color"],
|
wSku.fieldData["sku-values"]?.["color"],
|
||||||
syncer.parseColorGroup(pVariant.name),
|
expectedColor,
|
||||||
),
|
),
|
||||||
validateEquality(
|
validateEquality(
|
||||||
sku.fieldData["sku-values"]?.["size"],
|
wSku.fieldData["sku-values"]?.["size"],
|
||||||
pVariant.size,
|
pVariant.size,
|
||||||
),
|
),
|
||||||
validateEquality(
|
validateEquality(
|
||||||
sku.fieldData.price.value,
|
wSku.fieldData.price.value,
|
||||||
Math.round(+pVariant.retail_price * 100),
|
Math.round(+pVariant.retail_price * 100),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user