Skip to content

Commit

Permalink
Merge pull request #3267 from Akarshit/bugfix-updateVariant
Browse files Browse the repository at this point in the history
Checking if the variant belongs to current product
  • Loading branch information
spencern authored Nov 20, 2017
2 parents 2b4e608 + f78fe48 commit ef1c49c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ReactionProduct.setProduct = (currentProductId, currentVariantId) => {
if (product) {
// set the default variant
// as the default.
if (!variantId) {
if (!variantId || !variantIsSelected(variantId)) {
const variants = ReactionProduct.getTopVariants(productId);
variantId = Array.isArray(variants) && variants.length &&
variants[0]._id || null;
Expand Down

0 comments on commit ef1c49c

Please sign in to comment.