Update Product
Update Product Mutation
This mutation updates an existing product in the store with new information, pricing, variants, and metadata.
Use Cases​
- Product Information Updates: Modify product details, descriptions, and metadata
- Pricing Changes: Update product and variant pricing
- Inventory Management: Adjust stock quantities and tracking settings
- SEO Optimization: Update SEO metadata and URL handles
- Product Enhancement: Add new variants, options, and features
- Collection Management: Add or remove products from collections
- Status Changes: Activate, deactivate, or archive products
Key Features​
Product Updates​
- Basic Information: Update title, description, and product type
- Status Management: Change visibility, archive status, and product status
- Handle Updates: Modify URL-friendly product slugs
- Content Updates: Update HTML descriptions and short descriptions
Pricing and Variants​
- Price Updates: Modify product and variant pricing
- New Variants: Add additional product variants
- Existing Variants: Update existing variant information
- Cost Tracking: Update cost information for profit analysis
Options and Attributes​
- Option Management: Add, update, or remove product options
- Option Values: Modify available option values
- Attribute Updates: Update product attributes and values
- Position Control: Reorder options and values
Collection Management​
- Join Collections: Add product to new collections
- Leave Collections: Remove product from existing collections
- Bulk Collection Updates: Manage multiple collection relationships
Input Parameters​
$id: ID!- The unique identifier of the product to update$input: ProductInput!- Updated product information including:storeId: Store identifier (typically unchanged)title: Updated product name/titletype: Product type (if changing)descriptionHtml: Updated HTML product descriptionshortDescription: Updated brief product summaryhandle: Updated URL-friendly product slugisVisible: Updated visibility statusisArchived: Updated archive statusstatus: Updated product statusinitialPrice: Updated base product priceseo: Updated SEO metadatavariants: Array of updated/new product variantsoptions: Array of updated/new product optionscollectionsToJoin: Collections to add the product tocollectionsToLeave: Collections to remove the product from
$locale: String!- Language locale for the updated content
Response Structure​
The mutation would return an UpdateProductPayload containing:
product: Complete updated product object- All updated variants and options with new IDs where applicable
- Updated timestamps and metadata
- Current collection relationships
Update Behavior​
Existing Data​
- Variants with IDs: Updates existing variants
- Variants without IDs: Creates new variants
- Options with IDs: Updates existing options
- Options without IDs: Creates new options
Collection Management​
collectionsToJoin: Adds product to specified collectionscollectionsToLeave: Removes product from specified collections- Existing collection relationships remain unless explicitly removed
Example Response​
{
"data": {
"updateProduct": {
"product": {
"id": "Product_premium_headphones_001",
"title": "Premium Wireless Headphones Pro",
"handle": "premium-wireless-headphones-pro",
"type": "SIMPLE",
"status": "ACTIVE",
"isVisible": true,
"shortDescription": "Enhanced premium wireless headphones with 40-hour battery",
"descriptionHtml": "<p>Enhanced premium wireless headphones...</p>",
"updatedAt": "2024-01-15T14:30:00Z",
"variants": {
"nodes": [
{
"id": "Variant_existing_001",
"title": "Black / Standard",
"sku": "PWH-PRO-BLK-STD",
"price": {
"amount": 349.99,
"currencyCode": "USD"
},
"quantity": 75
},
{
"id": "Variant_new_002",
"title": "White / Standard",
"sku": "PWH-PRO-WHT-STD",
"price": {
"amount": 349.99,
"currencyCode": "USD"
},
"quantity": 50
}
]
},
"collections": {
"totalCount": 2,
"nodes": [
{
"id": "Collection_electronics_001",
"title": "Electronics & Gadgets"
},
{
"id": "Collection_audio_devices_002",
"title": "Audio Devices"
}
]
}
}
}
}
}
Implementation Notes​
Validation Requirements​
- Product ID must exist and be accessible
- Updated handle must be unique if changed
- Variant SKUs must remain unique
- Option-variant relationships must be consistent
Best Practices​
- Update only necessary fields to minimize conflicts
- Maintain SKU consistency when updating variants
- Preserve SEO-friendly handles when possible
- Update related collection relationships appropriately
- Consider inventory implications when updating variants
Error Handling​
- Handle product not found errors
- Validate handle uniqueness conflicts
- Check variant consistency with options
- Ensure proper permissions for updates
- Handle concurrent update conflicts
Performance Considerations​
- Batch variant updates when possible
- Minimize unnecessary field updates
- Consider impact on search indexes
- Update related caches and CDN content
Alternative Implementation​
Since this mutation may not be directly available, product updates might happen through:
- Separate Field Updates: Individual mutations for specific fields
- Variant-Specific Updates: Dedicated variant update mutations
- Batch Operations: Bulk update operations for multiple products
- Admin Interface: Product management through admin panels
Related Operations​
createProduct- Create new productsupdateProductVariant- Update specific product variantsaddProductsToCollection- Add products to collectionsremoveProductsFromCollection- Remove products from collectionsarchiveProducts- Archive multiple products
GraphQL Endpoint​
https://graphql.wuilt.com
Operation: UpdateProduct​
Try It Out​
Query​
Query Variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Note: Make sure to change the storeId with your store ID. For guidance on how to get your store ID, reference the Store ID guide.
Authentication​
To use this query, you will need an API key. Click the "API Key" button in the navigation bar to enter your credentials.