Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix checking if discount is not empty
Marcin Gębalac6df1308fea4
diff --git a/saleor/static/js/components/variantPicker/VariantPicker.js b/saleor/static/js/components/variantPicker/VariantPicker.jsindex 4d028a649e..2cbd81fcdd 100644--- a/saleor/static/js/components/variantPicker/VariantPicker.js+++ b/saleor/static/js/components/variantPicker/VariantPicker.js@@ -61,7 +61,6 @@ export default class VariantPicker extends Component {}, () => {this.matchVariantFromSelection();});- // todo: fix empty selection}handleQuantityChange = (event) => {diff --git a/saleor/static/js/components/variantPicker/VariantPrice.js b/saleor/static/js/components/variantPicker/VariantPrice.jsindex 520ba79022..062cd42dbd 100644--- a/saleor/static/js/components/variantPicker/VariantPrice.js+++ b/saleor/static/js/components/variantPicker/VariantPrice.js@@ -22,7 +22,7 @@ export default class VariantPrice extends Component {} else {// if there's no variant, fall back to product priceconst { discount, priceRange, priceRangeUndiscounted } = availability;- isDiscount = !!Object.keys(discount).length;+ isDiscount = discount && !!Object.keys(discount).length;priceText = `${priceRange.minPrice.gross} ${currency}`;priceUndiscountedText = `${priceRangeUndiscounted.minPrice.gross} ${currency}`;}diff --git a/saleor/static/js/stores/variantPicker.js b/saleor/static/js/stores/variantPicker.jsindex 7cd1430686..1df4f6fe1f 100644--- a/saleor/static/js/stores/variantPicker.js+++ b/saleor/static/js/stores/variantPicker.js@@ -1,15 +1,15 @@import { computed, observable } from 'mobx';class VariantPickerStore {- @observable variant = {}+ @observable variant = {}setVariant(variant) {this.variant = variant || {};}- @computed get isEmpty() {- return !this.variant.id;- }+ @computed get isEmpty() {+ return !this.variant.id;+ }}const store = new VariantPickerStore();