Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVDOCS-6116 [update]: MSF International Enhancements, schema changes #571

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
302 changes: 161 additions & 141 deletions docs/store-operations/catalog/graphql-admin/product-variant-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Using the Catalog features of the Admin API, you can set and query information a

Perform the following for product variant options:
- [Set global variant option information](#set-variant-options-at-the-global-level) for the catalog. Channels inherit global information by default.
- [Create overrides for a channel locale](#set-variant-options-for-a-locale) using the `overridesForLocale` field. These override global store information.
- [Create overrides for a channel locale](#set-variant-options-for-a-locale). These override global store information.
- [Remove overrides for a channel locale](#remove-variant-options-for-a-locale)

You can also set and remove information for [shared variant options](https://support.bigcommerce.com/s/article/Product-Options-v3?language=en_US#svo). The changes affect all products that you assign to the shared variant option. [Querying variant options](#query-product-variant-options) returns all variant options, including shared ones.
You can also set and remove information for [shared variant options](https://support.bigcommerce.com/s/article/Product-Options-v3?language=en_US#svo). Changing a shared variant option affects all products that you assign to the shared variant option. You cannot customize shared variant options on a product level. [Querying variant options](#query-product-variant-options) returns all variant options, including shared ones.
bc-andreadao marked this conversation as resolved.
Show resolved Hide resolved

For a full schema, see the [GraphQL Admin API reference](https://developer.bigcommerce.com/graphql-admin/reference).

Expand Down Expand Up @@ -446,15 +446,13 @@ The following example removes product variant option information for the locale
</Tab>
</Tabs>

## Set shared variant options
## Shared variant options

You can set information about a shared variant option for a store or a locale within a storefront channel. You must first create the shared variant options through the control panel. Changing a shared variant option affects all products that you assign to the shared variant option. You cannot customize shared variant options on a product level.
### Set shared variant options

The following mutations let you set the name and values for existing shared variant options.
You can set information about a shared variant option for a store or a locale within a storefront channel. You must first create the shared variant options through the control panel.

### Set shared variant options at the global level

The following example sets global shared variant option information for the store, from which channels inherit by default. You can set the name and values for existing variant options.
The following mutation sets the name and values for an existing shared variant option.

<Tabs items={['Request', 'Response']}>
<Tab>
Expand All @@ -465,11 +463,34 @@ The following example sets global shared variant option information for the stor
Content-Type: application/json
Accept: application/json

mutation ($input: SetSharedProductOptionsInformationInput!) {
mutation ($input: UpdateSharedProductOptionsInput!) {
sharedProductOptions {
setSharedProductOptionsInformation (input: $input) {
updateSharedProductOptions(input: $input) {
sharedProductOptions {
id
displayName
values {
id
isDefault
label
}
overrides(context: { channelId: "bc/store/channel/1", locale: "fr" }) {
edges {
node {
... on SharedProductOptionOverridesForChannelLocale {
context {
channelId
locale
}
displayName
values {
id
label
}
}
}
}
}
}
}
}
Expand All @@ -478,46 +499,90 @@ The following example sets global shared variant option information for the stor
```json filename="GraphQL variables" showLineNumbers copy
{
"input": {
"data": {
"options": [
{
"optionId": "bc/store/sharedProductOption/1",
"data": {
"dropdown": {
"displayName": "Fabric",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/123",
"label": "Cotton"
},
{
"valueId": "bc/store/sharedProductOptionValue/124",
"label": "Polyester"
"data": [
{
"optionId": "bc/store/sharedProductOption/1",
"optionData": {
"dropdown": {
"displayName": "Fabric",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/123",
"label": "Cotton"
},
{
"valueId": "bc/store/sharedProductOptionValue/124",
"label": "Polyester"
}
],
"overrides": [
{
"channelLocaleOverrides": {
"context": {
"channelId": "bc/store/channel/1",
"locale": "fr"
},
"data": {
"displayName": "Fabric channel override",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/123",
"label": "Cotton channel override"
},
{
"valueId": "bc/store/sharedProductOptionValue/124",
"label": "Polyester channel override"
}
]
}
}
]
}
}
]
}
},
{
"optionId": "bc/store/sharedProductOption/4",
"data": {
"swatch": {
"displayName": "Zipper color",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/129",
"label": "Orange"
},
{
"valueId": "bc/store/sharedProductOptionValue/130",
"label": "Green"
}
},
{
"optionId": "bc/store/sharedProductOption/4",
"optionData": {
"swatch": {
"displayName": "Zipper color",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/129",
"label": "Orange"
},
{
"valueId": "bc/store/sharedProductOptionValue/130",
"label": "Green"
}
],
"overrides": [
{
"channelLocaleOverrides": {
"context": {
"channelId": "bc/store/channel/1",
"locale": "fr"
},
"data": {
"displayName": "Zipper color override",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/129",
"label": "Orange override"
},
{
"valueId": "bc/store/sharedProductOptionValue/130",
"label": "Green override"
}
]
}
}
]
}
}
]
}
}
]
}
}
]
}
}
```
Expand All @@ -529,113 +594,68 @@ The following example sets global shared variant option information for the stor
{
"data": {
"sharedProductOptions": {
"setSharedProductOptionsInformation": {
"updateSharedProductOptions": {
"sharedProductOptions": [
{
"id": "bc/store/sharedProductOption/1"
},
{
"id": "bc/store/sharedProductOption/4"
}
]
}
}
}
}
```

</Tab>
</Tabs>

### Set shared variant options for a locale

The following example sets shared variant option information for the locale within the specified storefront channel. These override global store information. You can set the name and values for existing variant options.

<Tabs items={['Request', 'Response']}>
<Tab>

```graphql filename="Example mutation: Set shared variant options for a locale" showLineNumbers copy
POST https://api.bigcommerce.com/stores/{{STORE_HASH}}/graphql
X-Auth-Token: {{ACCESS_TOKEN}}
Content-Type: application/json
Accept: application/json

mutation ($input: SetSharedProductOptionsInformationInput!) {
sharedProductOptions {
setSharedProductOptionsInformation (input: $input) {
sharedProductOptions {
id
}
}
}
}
```
```json filename="GraphQL variables" showLineNumbers copy
{
"input": {
"localeContext": {
"channelId": "bc/store/channel/2",
"locale": "uk"
},
"data": {
"options": [
{
"optionId": "bc/store/sharedProductOption/1",
"data": {
"dropdown": {
"displayName": "Fabric material",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/123",
"label": "Linen"
},
"id": "bc/store/sharedProductOption/1",
"displayName": "Fabric",
"values": [
{
"id": "bc/store/sharedProductOptionValue/1",
"isDefault": true,
"label": "Cotton"
},
{
"id": "bc/store/sharedProductOptionValue/2",
"isDefault": false,
"label": "Polyester"
}
],
"overrides": {
"edges": [
{
"valueId": "bc/store/sharedProductOptionValue/124",
"label": "Nylon"
"node": {
"context": {
"channelId": "bc/store/channel/1",
"locale": "fr"
},
"displayName": "Fabric channel override",
"values": []
}
}
]
}
}
},
{
"optionId": "bc/store/sharedProductOption/4",
"data": {
"swatch": {
"displayName": "Color of zipper",
"values": [
{
"valueId": "bc/store/sharedProductOptionValue/129",
"label": "Black"
},
},
{
"id": "bc/store/sharedProductOption/4",
"displayName": "Zipper color",
"values": [
{
"id": "bc/store/sharedProductOptionValue/7",
"isDefault": false,
"label": "Orange"
},
{
"id": "bc/store/sharedProductOptionValue/8",
"isDefault": true,
"label": "Green"
}
],
"overrides": {
"edges": [
{
"valueId": "bc/store/sharedProductOptionValue/130",
"label": "Brown"
"node": {
"context": {
"channelId": "bc/store/channel/1",
"locale": "fr"
},
"displayName": "Zipper color override",
"values": []
}
}
]
}
}
}
]
}
}
}
```

</Tab>
<Tab>

```json filename="Example mutation: Set shared variant options for a locale" showLineNumbers copy
{
"data": {
"sharedProductOptions": {
"setSharedProductOptionsInformation": {
"sharedProductOptions": [
{
"id": "bc/store/sharedProductOption/1"
},
{
"id": "bc/store/sharedProductOption/4"
}
]
}
}
Expand Down
Loading