Skip to content

Commit

Permalink
🐛 Fix cross sell popup condition
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Feb 1, 2025
1 parent 390c4bc commit 593f280
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/mixins/cross-sell.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export default {
},
isCrossSellEnabled() {
const crossSellInfo = CROSS_SELL_WHITE_LIST.find(item => {
const id = item?.id || item;
const id = item.id || item;
return id === this.classId || id === this.collectionId;
});
const isCrossSellBlocked = !!crossSellInfo;
const isCrossSellBlocked = !crossSellInfo;
const probability =
crossSellInfo?.probability || CROSS_SELL_PRODUCT_PROBABILITY;
const shouldAttemptCrossSell = IS_TESTNET
Expand Down
12 changes: 6 additions & 6 deletions src/pages/nft/class/_classId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1465,11 +1465,12 @@ export default {
);
return;
}
const edition = this.getEdition(selectedValue);
if (this.isAddingToCart) {
this.handleAddToCart(selectedValue);
} else if (
this.shouldCrossSell ||
(this.hasCrossSell && this.edition.price === 0)
(this.hasCrossSell && edition.price === 0)
) {
this.selectedValue = selectedValue;
this.openCrossSellDialog();
Expand Down Expand Up @@ -1513,10 +1514,8 @@ export default {
this.addToCart(selectedValue);
this.uiPromptSuccessAlert(this.$t('cart_item_added'));
if (
this.shouldCrossSell ||
(this.hasCrossSell && this.edition.price === 0)
) {
const edition = this.getEdition(selectedValue);
if (this.shouldCrossSell || (this.hasCrossSell && edition.price === 0)) {
this.isAddingToCart = true;
this.openCrossSellDialog();
} else {
Expand Down Expand Up @@ -1808,11 +1807,12 @@ export default {
1
);
this.isTippingDialogOpen = false;
const edition = this.getEdition(this.selectedValue);
if (this.isAddingToCart) {
this.handleAddToCart();
} else if (
this.shouldCrossSell ||
(this.hasCrossSell && this.edition.price === 0)
(this.hasCrossSell && edition.price === 0)
) {
this.openCrossSellDialog();
} else {
Expand Down

0 comments on commit 593f280

Please sign in to comment.