Product URL
International Enhancements for Multi-Storefront
This feature is currently available for Enterprise stores and Partner Sandboxes. If the feature is not working as expected, please contact technical support, as the feature likely needs to be enabled for the individual store. To become an enterprise customer, contact your BigCommerce Customer Service Manager or our support team (opens in a new tab).
Using the Catalog features of the Admin API, you can set and query product URLs for a store or a locale within a storefront channel.
Perform the following:
- Set product URLs for the store. Channels inherit these by default.
- Create overrides for a channel's locale using the
overridesForLocale
mutation. The product URL for the locale overrides the global value. - Remove overrides for a channel's locale. The product URL then defaults to its global store value.
- Query product URL, those set at the global level and the overrides.
For a full schema, see the GraphQL Admin API reference (opens in a new tab).
Input fields
Setting or removing information requires that you specify ID fields in the input. For more information on how to specify ID fields, see Input fields.
Set product URL at the global level
The following example sets a product's URL for a store, from which channels inherit by default.
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
mutation ($input: SetProductUrlPathInput!) {
product {
setProductUrlPath (input: $input) {
product {
id
urlPath {
path
}
}
}
}
}
{
"input": {
"productId": "bc/store/product/111",
"data": {
"path": "/global-product-111"
}
}
}
Set product URL for a locale
The following example sets a product's URL for the locale within a storefront channel. These settings override global store information.
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
mutation ($input: SetProductUrlPathInput!) {
product {
setProductUrlPath (input: $input) {
product {
id
overridesForLocale (localeContext: { channelId: "bc/store/channel/2", locale: "uk" }) {
urlPath {
path
}
}
}
}
}
}
{
"input": {
"productId": "bc/store/product/111",
"localeContext": {
"channelId": "bc/store/channel/2",
"locale": "uk"
},
"data": {
"path": "/overrides-product-111"
}
}
}
Remove product URL for a locale
The following example removes the overrides for a product's URL. This mutation removes the overrides for the locale within the storefront channel, and the product URL defaults to its global store value.
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
mutation ($input: RemoveProductUrlPathOverrideInput!) {
product {
removeProductUrlPathOverride (input: $input) {
product {
id
urlPath {
path
}
}
}
}
}
{
"input": {
"productId": "b/store/product/111",
"localeContext": {
"channelId": "bc/store/channel/2",
"locale": "uk"
}
}
}
Query product URL
The following example retrieves a product's URL. You can retrieve global information for the store and overrides for a locale within a storefront channel.
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json
query {
store {
product (id: "bc/store/product/111") {
id
urlPath {
path
}
overridesForLocale (localeContext: { channelId: "bc/store/channel/2", locale: "uk" }) {
urlPath {
path
}
}
}
}
}