So, I’m a super-nubie with this coding stuff; nonetheless, I figured out how to implement Wix’s tutorial “Cross-Selling a Product in Your Store.”
However, for my store, I need to check multiple sku’s. I tried throwing in an array…did not work. Any ideas?
import wixData from'wix-data';
import { getCurrentCart } from'backend/cart.jsw';
const CROSS_SELL_PRODUCT_SKU = ["005","006","007"];
I have read the article of “Cross-Selling a Product in your Wix Store”. If you want to display more then one product, you need to change the code according to your requirement. like
await wixData.query(‘Stores/Products’).eq(‘sku’, CROSS_SELL_PRODUCT_SKU).find();
Change to
await wixData.query(‘Stores/Products’).hasSome(‘sku’, CROSS_SELL_PRODUCT_SKU).find();
Thank you, for responding so quickly! However (and I’m sorry I didn’t clarify this more in my initial post), I’m looking to render/display 1 product only if the user does not have any of these 7 particular products in their cart: sku “001”,“002”,“003”,“004”,“005”,“006”,“007”
After playing around a bit, I noticed that I can name each of the 7 products as a constant,
constCROSS_SELL_PRODUCT_SKU1="001";
constCROSS_SELL_PRODUCT_SKU2="002";
constCROSS_SELL_PRODUCT_SKU3="003";
constCROSS_SELL_PRODUCT_SKU4="004";
constCROSS_SELL_PRODUCT_SKU5="005";
constCROSS_SELL_PRODUCT_SKU6="006";
constCROSS_SELL_PRODUCT_SKU7="007";
and then refer to each of them individually in the async function:
async function checkIfProductMissingFromCart() {
const { lineItems } = await getCurrentCart();
const isProductMissingFromCart = lineItems.every(lineItem => lineItem.sku !== CROSS_SELL_PRODUCT_SKU1 && lineItem.sku !== CROSS_SELL_PRODUCT_SKU2 && lineItem.sku !== CROSS_SELL_PRODUCT_SKU3 && lineItem.sku !== CROSS_SELL_PRODUCT_SKU4 && lineItem.sku !== CROSS_SELL_PRODUCT_SKU5 && lineItem.sku !== CROSS_SELL_PRODUCT_SKU6 && lineItem.sku !== CROSS_SELL_PRODUCT_SKU7);
return isProductMissingFromCart;
}
It seems to work, although I’m not sure if it’s the most graceful way of approaching it!
Please let me know if you have a better solution than mine! 
Also, thank you Rashid for your .hasSome snippet. I can use that idea on another page of the store!