A
Alokai•2y ago
co0lkid02

How to add additional field to Customer Type

compared to what it is said in the documentation I'm only able to get few information from the user using useUser composable. I want to get the customergroupid the user has but when I console log user.value im only getting few details like in the screenshot. So where and how to add the types for customer.
3 Replies
rohrig
rohrig•2y ago
Hi @san123 👋 , how to add that information to the response will differ depending on the backend you're using. For the frontend you can extend the query: https://docs.vuestorefront.io/v2/composition/extending-graphql-queries.html
Extending GraphQL queries | Vue Storefront 2
Vue Storefront 2 documentation
co0lkid02
co0lkid02OP•2y ago
I am using commercetools as backend. which function of the useUser composable we should extend to pass the custom query?
rohrig
rohrig•2y ago
@san123 I asked my go-to expert in CT and he said this: The useUser composable has the load method which populates the user property. You can call the load() method with the following parameter:
load({
customQuery: {
getBasicProfile: 'your-custom-query-name-from-middleware-config'
}
});
load({
customQuery: {
getBasicProfile: 'your-custom-query-name-from-middleware-config'
}
});
It is described in the useUser documentation here: https://docs.vuestorefront.io/commercetools/composables/use-user.html.
Want results from more Discord servers?
Add your server