A
Alokaisan123

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.
R
rohrig353d 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
S
san123353d ago
I am using commercetools as backend. which function of the useUser composable we should extend to pass the custom query?
R
rohrig353d 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.