A
Alokaiβ€’12mo ago
Julien

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", });
5 Replies
rohrig
rohrigβ€’12mo ago
Hi πŸ‘‹ , can you elaborate on what you're trying to achieve?
Julien
JulienOPβ€’12mo ago
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 πŸ™‚
rohrig
rohrigβ€’12mo ago
Can you try using a custom query?
rohrig
rohrigβ€’12mo ago
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...
Julien
JulienOPβ€’12mo ago
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 ?
Want results from more Discord servers?
Add your server