Add SearchProduct params or variables
Hi, i need to pass extra params or variables to useProduct search params to get price depending on customerGroupId, is it possible ?
await searchProducts({ slug: route.value.params.slug, customQuery: { products: 'productsQuery', }, customerGroupId: "userCustomGroupId", });
await searchProducts({ slug: route.value.params.slug, customQuery: { products: 'productsQuery', }, customerGroupId: "userCustomGroupId", });
5 Replies
Hi π , can you elaborate on what you're trying to achieve?
Hi !,Sure, actually i'm using composable useProduct to get my product details, but i'd like to get price depending on the customerGroupId of the customer.
So i'd like to pass it through my query to use it in my price fragment:
fragment Price on ProductVariant {
price(currency: $currency, country: $country, channelId: $channelId, customerGroupId: $customerGroupId) {
...DefaultProductPrice
}
}
but actually can't pass this params on useProduct composable.
Maybe it's not the good way to do it π
Can you try using a custom query?
Vue Storefront
YouTube
Using Custom Queries in Vue Storefront 2
Vue Storefront uses Composables that under the hood are sending GraphQL queries to the appriopriate e-commerce platform. In this video tutorial, our Senior Fullstack Developer and Dev π₯ Under Cover - Jakub Andrzejewski, will guide you through the process of creating and using a custom query so that you can use your custom query to get the data y...
Unfortunately i'm using a custom query.
My problem is, how to pass dynamically customerGroupId to the query.
Is it possible to add variables to useProduct composable ?