Skip to content

Commit 9ac1fdd

Browse files
vitorrggleomp12
andauthored
fix: checking if condition matches one of the possible values (#63)
* checking if condition matchs one of the possible values * Update gmc-to-ecom.js --------- Co-authored-by: Leonardo Matos <[email protected]>
1 parent 99b82ed commit 9ac1fdd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

functions/lib/gmc-to-ecom.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const tryImageUpload = async (storeId, auth, originImgUrl, product) => {
195195
const parseProduct = async (appSdk, appData, auth, storeId, feedProduct, product = {}, meta = {}) => {
196196
try {
197197
const categories = await getCategory(appSdk, storeId, feedProduct)
198-
const condition = getFeedValueByKey('condition', feedProduct)
198+
const condition = getFeedValueByKey('condition', feedProduct)?.toLowerCase()
199199
const newProductData = {
200200
sku: (getFeedValueByKey('sku', feedProduct) || getFeedValueByKey('id', feedProduct) || getFeedValueByKey('ID', feedProduct)).toString()
201201
.replace(/\s+/g, '_'),
@@ -255,7 +255,7 @@ const parseProduct = async (appSdk, appData, auth, storeId, feedProduct, product
255255
if (mpn) {
256256
newProductData.mpn = [mpn.toString()]
257257
}
258-
if (condition) {
258+
if (condition === 'new' || condition === 'refurbished' || condition === 'used' || condition === 'not_specified') {
259259
newProductData.condition = condition
260260
}
261261
const dimensions = ['shipping_length', 'shipping_width', 'shipping_height']

0 commit comments

Comments
 (0)