Skip to content

Commit

Permalink
fix(productDiff): diff variants by sku or id
Browse files Browse the repository at this point in the history
  • Loading branch information
philippspo committed Jan 21, 2016
1 parent 4c4d40f commit 9e510f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/coffee/sync/utils/product.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class ProductUtils extends BaseUtils
# Otherwise let's use the provided id.
# If there is no SKU and no ID present, throw an error
patchVariantId = (variant, index) ->
if variant.id?
variant._MATCH_CRITERIA = "#{variant.id}"
if variant.sku?
variant._MATCH_CRITERIA = variant.sku
else if variant.id?
variant._MATCH_CRITERIA = "#{variant.id}"
debug 'patched id (with criteria %s) for variant: %j', variant._MATCH_CRITERIA, variant
if not variant._MATCH_CRITERIA?
throw new Error 'A variant must either have an ID or an SKU.'
Expand Down

0 comments on commit 9e510f3

Please sign in to comment.