morewines / refund-calculator-bigcommerce

http://partialrefundcalculator.com/
GNU General Public License v3.0
0 stars 0 forks source link

bigcommerce sometimes assigns the wrong sku #18

Open amaidah opened 6 years ago

amaidah commented 6 years ago

Example order: 35915

amaidah commented 6 years ago

Added a check in /lib/bigCommerce

      // there can be an error here with BC assigning the wrong sku to the product
      if (skuData.data.length > 0) {
        productArr[i].url = skuData.data[0].custom_url.url;
      }

because a previous call to the BC API can return empty since pulling the SKU value given by BC can be incorrect.

Sku should be 109030, instead BC is saying the SKU for this product is 35655 (which is actually the order number) so the API call is returning empty.

amaidah commented 6 years ago

Doing this basic check seems to be fine unless more errors from BC side popup in the future.