Navlinks
The Navlinks structure is used to dynamically build a navigation header for your store.
You can hardcode the navigation header on your store, or you can use navlinks to update it dynamically. Navlinks are also used to build navigation for hosted stores.
The navlinks structure is made up of nodes that represent tags. Nodes can be nested and used to easily build a tag filter for querying products.
Navlinks can be configured by going to the Navlinks section on the dashboard.
The NavLink object
Fields
- Name
node_id
- Type
- integer
- Tags
- Description
ID of the navlink node.
- Name
parent_node_id
- Type
- string
- Tags
- NULLABLE
- Description
ID of the parent node, if any. This field is nullable and would be null if the navlink node is a root node.
- Name
store_id
- Type
- integer
- Tags
- Description
ID of the store the navlink belongs to.
- Name
tag_id
- Type
- integer
- Tags
- Description
ID of the tag the navlink represents.
- Name
tag_slug
- Type
- string
- Tags
- Description
A URL-safe version of the tag name.
- Name
name
- Type
- string
- Tags
- Description
Name of the navlink node.
- Name
order
- Type
- integer
- Tags
- Description
The order in which the navlink node appears in the navigation structure.
The NavLink object
{
"node_id": 123,
"parent_node_id": null,
"store_id": 456,
"tag_id": 789,
"tag_slug": "example-tag",
"name": "Example NavLink",
"order": 1
}
Get Navlinks
This endpoint fetches all the navlinks associated with a specified store ID, which can be used to build the navigation structure dynamically.
Returns
Returns an array of NavLink objects.
Get Navlinks Response
[
{
"node_id": 123,
"parent_node_id": null,
"store_id": 456,
"tag_id": 789,
"tag_slug": "example-tag",
"name": "Example NavLink",
"order": 1
},
{
// ...other navlinks
}
]
Update Navlinks Layout
This endpoint updates the layout of navlinks for a specified store. By specifying a navlink ID in the URL, and providing the ParentNodeID
, TagID
, and Order
in the request body, the nesting and ordering of navlinks can be updated dynamically.
Fields
- Name
parent_node_id
- Type
- string?
- Tags
- OPTIONAL
- Description
The ID of the parent node. If this field is omitted or set to null, the navlink will be treated as a root node.
- Name
tag_id
- Type
- integer
- Tags
- Description
The ID of the tag the navlink represents.
- Name
order
- Type
- integer
- Tags
- Description
The order in which the navlink should appear in the navigation structure.
Returns
Returns the updated NavLink object.
Update Navlinks Layout Request
{
"parent_node_id": null,
"tag_id": 789,
"order": 2
}
Update Navlinks Layout Response
{
"node_id": 123,
"parent_node_id": null,
"store_id": 456,
"tag_id": 789,
"tag_slug": "updated-tag",
"name": "Updated NavLink",
"order": 2
}
Delete NavLink Node
This endpoint deletes a specified navlink node based on the provided store and navlink node ID.
Returns
Returns HTTP 204
indicating that the navlink node has been successfully deleted.
Response
HTTP 204