Skip to content

Commit

Permalink
fix: checking if condition matches one of the possible values (#63)
Browse files Browse the repository at this point in the history
* checking if condition matchs one of the possible values

* Update gmc-to-ecom.js

---------

Co-authored-by: Leonardo Matos <[email protected]>
  • Loading branch information
vitorrgg and leomp12 authored Sep 25, 2024
1 parent 99b82ed commit 9ac1fdd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/lib/gmc-to-ecom.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const tryImageUpload = async (storeId, auth, originImgUrl, product) => {
const parseProduct = async (appSdk, appData, auth, storeId, feedProduct, product = {}, meta = {}) => {
try {
const categories = await getCategory(appSdk, storeId, feedProduct)
const condition = getFeedValueByKey('condition', feedProduct)
const condition = getFeedValueByKey('condition', feedProduct)?.toLowerCase()
const newProductData = {
sku: (getFeedValueByKey('sku', feedProduct) || getFeedValueByKey('id', feedProduct) || getFeedValueByKey('ID', feedProduct)).toString()
.replace(/\s+/g, '_'),
Expand Down Expand Up @@ -255,7 +255,7 @@ const parseProduct = async (appSdk, appData, auth, storeId, feedProduct, product
if (mpn) {
newProductData.mpn = [mpn.toString()]
}
if (condition) {
if (condition === 'new' || condition === 'refurbished' || condition === 'used' || condition === 'not_specified') {
newProductData.condition = condition
}
const dimensions = ['shipping_length', 'shipping_width', 'shipping_height']
Expand Down

0 comments on commit 9ac1fdd

Please sign in to comment.