---
title: Intents
description: >-
The Intents API launches Shopify's native admin interfaces for creating and
editing resources. When your extension calls an intent, merchants complete
their changes using the standard Shopify admin UI, and your app receives the
result. This means you don't need to build custom forms.
Use this API to build workflows like adding products to collections, creating
multiple related resources in a sequence (like a product, collection, and
discount for a promotion), opening specific resources for editing, or
launching discount creation with pre-selected types.
api_name: app-home
source_url:
html: >-
https://shopify.dev/docs/api/app-home/apis/user-interface-and-interactions/intents
md: >-
https://shopify.dev/docs/api/app-home/apis/user-interface-and-interactions/intents.md
---
# Intents
The Intents API launches Shopify's native admin interfaces for creating and editing resources. When your extension calls an intent, merchants complete their changes using the standard Shopify admin UI, and your app receives the result. This means you don't need to build custom forms.
Use this API to build workflows like adding products to collections, creating multiple related resources in a sequence (like a product, collection, and discount for a promotion), opening specific resources for editing, or launching discount creation with pre-selected types.
#### Use cases
* **Resource creation:** Invoke admin workflows to create products, collections, discounts, or other Shopify resources.
* **Resource editing:** Open existing Shopify resources for editing using their admin workflows.
* **Workflow completion:** Await the result of an intent to determine whether the merchant completed or cancelled the operation.
* **Admin consistency:** Use native Shopify admin workflows instead of building custom forms for resource management.
## invoke
The `invoke` API is a function that accepts either a string query or an options object describing the intent to invoke and returns a Promise that resolves to an activity handle for the workflow.
## Intent Format
Intents are invoked using a string query format: `${action}:${type},${value}`
Where:
* `action` - The operation to perform (`create` or `edit`)
* `type` - The resource type (e.g., `shopify/Product`)
* `value` - The resource identifier (only for edit actions)
## Supported Resources
### Article
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Article` | — | — |
| `edit` | `shopify/Article` | `gid://shopify/Article/{id}` | — |
### Catalog
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Catalog` | — | — |
| `edit` | `shopify/Catalog` | `gid://shopify/Catalog/{id}` | — |
### Collection
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Collection` | — | — |
| `edit` | `shopify/Collection` | `gid://shopify/Collection/{id}` | — |
### Customer
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Customer` | — | — |
| `edit` | `shopify/Customer` | `gid://shopify/Customer/{id}` | — |
### Discount
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Discount` | — | `{ type: 'amount-off-product' \| 'amount-off-order' \| 'buy-x-get-y' \| 'free-shipping' }` |
| `edit` | `shopify/Discount` | `gid://shopify/Discount/{id}` | — |
### Location
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Location` | — | — |
| `edit` | `shopify/Location` | `gid://shopify/Location/{id}` | — |
### Market
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Market` | — | — |
| `edit` | `shopify/Market` | `gid://shopify/Market/{id}` | — |
### Menu
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Menu` | — | — |
| `edit` | `shopify/Menu` | `gid://shopify/Menu/{id}` | — |
### Metafield Definition
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/MetafieldDefinition` | — | `{ ownerType: 'product' }` |
| `edit` | `shopify/MetafieldDefinition` | `gid://shopify/MetafieldDefinition/{id}` | `{ ownerType: 'product' }` |
### Metaobject
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Metaobject` | — | `{ type: 'shopify--color-pattern' }` |
| `edit` | `shopify/Metaobject` | `gid://shopify/Metaobject/{id}` | `{ type: 'shopify--color-pattern' }` |
### Metaobject Definition
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/MetaobjectDefinition` | — | — |
| `edit` | `shopify/MetaobjectDefinition` | — | `{ type: 'my_metaobject_definition_type' }` |
### Page
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Page` | — | — |
| `edit` | `shopify/Page` | `gid://shopify/Page/{id}` | — |
### Product
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/Product` | — | — |
| `edit` | `shopify/Product` | `gid://shopify/Product/{id}` | — |
### Product Variant
| Action | Type | Value | Data |
| - | - | - | - |
| `create` | `shopify/ProductVariant` | — | `{ productId: 'gid://shopify/Product/{id}' }` |
| `edit` | `shopify/ProductVariant` | `gid://shopify/ProductVariant/{id}` | `{ productId: 'gid://shopify/Product/{id}' }` |
**Note:** To determine whether to use the \\shopify\/Product\Variant\\ \edit\ intent or the \\shopify\/Product\\ \edit\ intent, query the \\\product.has\Only\Default\Variant\\\ field. If the product has only the default variant (\\has\Only\Default\Variant\\ is \true\), use the \\shopify\/Product\\ \edit\ intent.
### Settings
> Settings are the configuration options for the store. Use this to invoke and edit settings.
| Action | Type | Value | Data |
| - | - | - | - |
| `edit` | `settings/StoreDetails` | — | — |
| `edit` | `settings/StoreDefaults` | — | — |
| `edit` | `settings/OrderIdFormat` | — | — |
| `edit` | `settings/OrderProcessing` | — | — |
| `edit` | `settings/LocationDefault` | — | — |
* **invoke**
**{ (query: IntentQuery): Promise\; (intentURL: string, options?: IntentQueryOptions): Promise\; }**
Invoke an intent using the object syntax.
Invoke an intent using the URL syntax.
URL format: `action:type[,value][?params]`.
* **response**
**IntentResponseApi**
If in an intent workflow, provides mechanisms to resolve the intent with a given response.
### IntentQuery
* action
```ts
IntentAction
```
* data
Additional data required for certain intent types. For example: - Discount creation requires { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' } - ProductVariant creation requires { productId: 'gid://shopify/Product/123' } - Metaobject creation requires { type: 'shopify--color-pattern' }
```ts
{ [key: string]: unknown; }
```
* type
```ts
IntentType
```
* value
The resource identifier for edit actions (e.g., 'gid://shopify/Product/123').
```ts
string
```
### IntentAction
The action to perform on a resource.
```ts
'create' | 'edit'
```
### IntentType
Supported resource types that can be targeted by intents.
```ts
'shopify/Article' | 'shopify/Catalog' | 'shopify/Collection' | 'shopify/Customer' | 'shopify/Discount' | 'shopify/Market' | 'shopify/Menu' | 'shopify/MetafieldDefinition' | 'shopify/Metaobject' | 'shopify/MetaobjectDefinition' | 'shopify/Page' | 'shopify/Product' | 'shopify/ProductVariant'
```
### IntentActivity
Activity handle for tracking intent workflow progress.
* complete
A Promise that resolves when the intent workflow completes, returning the response.
```ts
Promise
```
### IntentResponse
Result of an intent activity. Discriminated union representing all possible completion outcomes.
```ts
ClosedIntentResponse | SuccessIntentResponse | ErrorIntentResponse
```
### ClosedIntentResponse
User dismissed or closed the workflow without completing it.
* code
```ts
'closed'
```
### SuccessIntentResponse
Successful intent completion.
* code
```ts
'ok'
```
* data
```ts
{ [key: string]: unknown; }
```
### ErrorIntentResponse
Failed intent completion.
* code
```ts
'error'
```
* issues
```ts
Issue[]
```
* message
```ts
string
```
### IntentQueryOptions
Options for invoking intents when using the query string format.
* data
Additional data required for certain intent types. For example: - Discount creation requires { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' } - ProductVariant creation requires { productId: 'gid://shopify/Product/123' } - Metaobject creation requires { type: 'shopify--color-pattern' }
```ts
{ [key: string]: unknown; }
```
* value
The resource identifier for edit actions (e.g., 'gid://shopify/Product/123').
```ts
string
```
### IntentResponseApi
* closed
If in an intent workflow, resolves the intent with a closed response.
```ts
() => Promise
```
* error
If in an intent workflow, resolves the intent with an error response and the provided message and issues, if any.
```ts
(message: string, issues?: Issue[]) => Promise
```
* ok
If in an intent workflow, resolves the intent with a success response and the provided data, if any.
```ts
(data?: { [key: string]: unknown; }) => Promise
```
## IntentAction
Supported actions that can be performed on resources.
* `create`: Opens a creation workflow for a new resource
* `edit`: Opens an editing workflow for an existing resource (requires `value` parameter)
**`'create' | 'edit'`**
## IntentType
Supported resource types that can be targeted by intents.
**`'shopify/Article' | 'shopify/Catalog' | 'shopify/Collection' | 'shopify/Customer' | 'shopify/Discount' | 'shopify/Market' | 'shopify/Menu' | 'shopify/MetafieldDefinition' | 'shopify/Metaobject' | 'shopify/MetaobjectDefinition' | 'shopify/Page' | 'shopify/Product' | 'shopify/ProductVariant'`**
## IntentQueryOptions
Options for invoking intents when using the query string format.
* **data**
**{ \[key: string]: unknown; }**
Additional data required for certain intent types. For example:
* Discount creation requires { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' }
* ProductVariant creation requires { productId: 'gid://shopify/Product/123' }
* Metaobject creation requires { type: 'shopify--color-pattern' }
* **value**
**string**
The resource identifier for edit actions (e.g., 'gid://shopify/Product/123').
## IntentResponse
Response object returned when the intent workflow completes.
**`ClosedIntentResponse | SuccessIntentResponse | ErrorIntentResponse`**
### ClosedIntentResponse
* **code**
**'closed'**
### ErrorIntentResponse
* **code**
**'error'**
* **issues**
**Issue\[]**
* **message**
**string**
### SuccessIntentResponse
* **code**
**'ok'**
* **data**
**{ \[key: string]: unknown; }**
### ClosedIntentResponse
User dismissed or closed the workflow without completing it.
* code
```ts
'closed'
```
### SuccessIntentResponse
Successful intent completion.
* code
```ts
'ok'
```
* data
```ts
{ [key: string]: unknown; }
```
### ErrorIntentResponse
Failed intent completion.
* code
```ts
'error'
```
* issues
```ts
Issue[]
```
* message
```ts
string
```
Examples
## Preview

### Examples
* #### Create a new collection
##### Description
Launch the collection creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Collection');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Collection created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new article
##### Description
Launch the article creation workflow in the Shopify admin. The merchant writes and publishes the article using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Article');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Article created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing article
##### Description
Open an existing article for editing in the Shopify admin. Pass the article's GID (for example, \`gid://shopify/Article/123456789\`) as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Article', {
value: 'gid://shopify/Article/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Article updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new catalog
##### Description
Launch the catalog creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Catalog');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Catalog created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing catalog
##### Description
Open an existing catalog for editing in the Shopify admin. Pass the catalog's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Catalog', {
value: 'gid://shopify/Catalog/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Catalog updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new collection
##### Description
Launch the collection creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Collection');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Collection created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing collection
##### Description
Open an existing collection for editing in the Shopify admin. Pass the collection's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Collection', {
value: 'gid://shopify/Collection/987654321',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Collection updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new customer
##### Description
Launch the customer creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Customer');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Customer created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing customer
##### Description
Open an existing customer for editing in the Shopify admin. Pass the customer's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Customer', {
value: 'gid://shopify/Customer/456789123',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Customer updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new discount
##### Description
Launch the discount creation workflow in the Shopify admin. You must specify the discount type in the \`data\` parameter. Valid types are \`'amount-off-product'\`, \`'amount-off-order'\`, \`'buy-x-get-y'\`, and \`'free-shipping'\`. Your app receives the result when the merchant completes the workflow.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Discount', {
data: {type: 'amount-off-product'},
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Discount created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing discount
##### Description
Open an existing discount for editing in the Shopify admin. Pass the discount's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Discount', {
value: 'gid://shopify/Discount/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Discount updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create location
##### Description
Create a new location. Opens the location creation workflow.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Location');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Location created:', response.data);
}
```
* #### Edit location
##### Description
Edit an existing location. Requires a location GID.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Location', {
value: 'gid://shopify/Location/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Location updated:', response.data);
}
```
* #### Edit location default
##### Description
Edit the default location.
##### Default
```js
const activity = await shopify.intents.invoke('edit:settings/LocationDefault');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Settings updated:', response.data);
}
```
* #### Create a new market
##### Description
Launch the market creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Market');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Market created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing market
##### Description
Open an existing market for editing in the Shopify admin. Pass the market's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Market', {
value: 'gid://shopify/Market/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Market updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new menu
##### Description
Launch the menu creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Menu');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Menu created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing menu
##### Description
Open an existing menu for editing in the Shopify admin. Pass the menu's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Menu', {
value: 'gid://shopify/Menu/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Menu updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new metafield definition
##### Description
Launch the metafield definition creation workflow in the Shopify admin. You must specify the owner type in the \`data\` parameter (for example, \`'product'\`). Your app receives the result when the merchant completes the workflow.
##### Default
```js
const activity = await shopify.intents.invoke(
'create:shopify/MetafieldDefinition',
{data: {ownerType: 'product'}},
);
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Metafield definition created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing metafield definition
##### Description
Open an existing metafield definition for editing in the Shopify admin. Pass the metafield definition's GID as the value and the owner type in the \`data\` parameter. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke(
'edit:shopify/MetafieldDefinition',
{
value: 'gid://shopify/MetafieldDefinition/123456789',
data: {ownerType: 'product'},
},
);
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Metafield definition updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new metaobject
##### Description
Launch the metaobject creation workflow in the Shopify admin. You must specify the metaobject type in the \`data\` parameter (for example, \`'shopify--color-pattern'\`). Your app receives the result when the merchant completes the workflow.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Metaobject', {
data: {type: 'shopify--color-pattern'},
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Metaobject created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing metaobject
##### Description
Open an existing metaobject for editing in the Shopify admin. Pass the metaobject's GID as the value and the metaobject type in the \`data\` parameter. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Metaobject', {
value: 'gid://shopify/Metaobject/123456789',
data: {type: 'shopify--color-pattern'},
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Metaobject updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new metaobject definition
##### Description
Launch the metaobject definition creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke(
'create:shopify/MetaobjectDefinition',
);
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Metaobject definition created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing metaobject definition
##### Description
Open an existing metaobject definition for editing in the Shopify admin. Pass the metaobject definition type in the \`data\` parameter. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke(
'edit:shopify/MetaobjectDefinition',
{data: {type: 'my_metaobject_definition_type'}},
);
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Metaobject definition updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new page
##### Description
Launch the page creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Page');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Page created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing page
##### Description
Open an existing page for editing in the Shopify admin. Pass the page's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Page', {
value: 'gid://shopify/Page/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Page updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new product
##### Description
Launch the product creation workflow in the Shopify admin. The merchant completes the form using the standard Shopify admin UI, and your app receives the result when the workflow completes.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/Product');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Product created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing product
##### Description
Open an existing product for editing in the Shopify admin. Pass the product's GID as the value. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/Product', {
value: 'gid://shopify/Product/123456789',
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Product updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Create a new product variant
##### Description
Launch the product variant creation workflow in the Shopify admin. You must specify the parent product's GID in the \`data\` parameter. Your app receives the result when the merchant completes the workflow.
##### Default
```js
const activity = await shopify.intents.invoke('create:shopify/ProductVariant', {
data: {productId: 'gid://shopify/Product/123456789'},
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Product variant created:', response.data);
} else if (response.code === 'closed') {
console.log('Creation cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit an existing product variant
##### Description
Open an existing product variant for editing in the Shopify admin. Pass the variant's GID as the value and the parent product's GID in the \`data\` parameter. Your app receives the updated data when the merchant saves their changes.
##### Default
```js
const activity = await shopify.intents.invoke('edit:shopify/ProductVariant', {
value: 'gid://shopify/ProductVariant/123456789',
data: {productId: 'gid://shopify/Product/123456789'},
});
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Product variant updated:', response.data);
} else if (response.code === 'closed') {
console.log('Edit cancelled by user');
} else if (response.code === 'error') {
console.log('Error:', response.message);
}
```
* #### Edit store details
##### Description
Invoke and edit store details.
##### Default
```js
const activity = await shopify.intents.invoke('edit:settings/StoreDetails');
const response = await activity.complete;
if (response.code === 'closed') {
console.log('Settings closed:', response.data);
}
```
* #### Edit store defaults
##### Description
Invoke and edit store defaults.
##### Default
```js
const activity = await shopify.intents.invoke('edit:settings/StoreDefaults');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Settings updated:', response.data);
}
```
* #### Edit order ID format
##### Description
Invoke and edit order ID format.
##### Default
```js
const activity = await shopify.intents.invoke('edit:settings/OrderIdFormat');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Settings updated:', response.data);
}
```
* #### Edit order processing
##### Description
Invoke and edit order processing.
##### Default
```js
const activity = await shopify.intents.invoke('edit:settings/OrderProcessing');
const response = await activity.complete;
if (response.code === 'ok') {
console.log('Settings updated:', response.data);
}
```