Question:
How can I query for products that are not visible?
Product:
Editor X with Velo
What are you trying to achieve:
I want to be able to query for products that are not visible in the store, cause I want to be able to add them programmatically to the cart but I don’t want the customer to be able to view them. As it stands now when I query for the products (that are not visible), they won’t be returned.
What have you already tried:
import { products } from 'wix-stores.v2';
export async function getProductBySKU(sku) {
const results = await products
.queryProducts()
.eq('sku', sku)
.find();
if (results.items.length > 0) {
const items = results.items;
return items;
} else {
// Handle if no matching items found
}
}
This works great for visible products, but I need it to include hidden products too. And beyond the query, I’ll need to call the addProducts
method on the FE to add the product to the cart, so I’m hoping that’s still possible for hidden products.
Additional information:
None