I've enabled at backoffice the usage of the category inside the product url by setting this option:
When I access the magento frontend, I can now access the product with the url <category>/<product>
. However, when I call the graphQL API:
query {
products(filter: {
sku: {
eq: "1"
}
}) {
items {
sku
canonical_url
url_path
url_key
}
}
}
I get this response:
{
"data": {
"products": {
"items": [
{
"sku": "1",
"canonical_url": "tire-black",
"url_path": null,
"url_key": "tire-black"
}
]
}
}
}
In other words, I get the path url with the product name only,(i.e. without the category). In the example, the product tire-black
belongs to the category tires
. In the url_rewrite
table the associated url with the category is: tires/tire-black
, which is what I want to retrieve using the graphQL.
Do you know if there's another field I should use to get the url comprehensive of the category (i.e. tires/tire-black
)?
If not, what should I do to get it in the graphql response?
Thank you.