What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Bundled product on the admin rest API

Solved

Bundled product on the admin rest API

sengming
Shopify Partner
52 1 9

Hi there,

 

I recently created a bundled product

 

https://maxim-khanate.myshopify.com/admin/products/6766421901376

 

When I look at it with the admin REST API

 

 
there is no indication that it is a bundled product. It looks just like a regular product.
 
How do I figure out whether a product is a bundled product with the admin REST API?
 
Thank you!
Accepted Solution (1)
ShopifyDevSup
Shopify Staff
1453 238 525

This is an accepted solution.

Hi @sengming 

 

If the app that created the bundle didn't add any metafieds then that it may have been setup as a fixed bundle through GraphQL.

 

In that case I don't see any option to identify variants or their bundled components from the REST Admin API, but you could always use the GraphQL Admin API to verify a productVariant with a request like this:

 

query bundledVariant($id: ID!) {
node(id: $id) {
 ... on ProductVariant {
  id
  requiresComponents
  productVariantComponents(first: 3) {
   nodes {
    id
    quantity
   }
  }
 }
}
}

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 5 (5)

ShopifyDevSup
Shopify Staff
1453 238 525

Hi @sengming,

 

The REST Admin API doesn't expose a requiresComponents field on the productVariant object like the GraphQL Admin API, but our guide on how to model a bundle says:

 "You model a bundle by creating metafields on variants, creating a bundle parent product variant, and defining the bundle on child product variants."


Have you checked for any metafields associated with your product's variants?

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

sengming
Shopify Partner
52 1 9

there are no metafileds associated with the variants (see request and response below). Do you have any other suggestions?

 

```

GET https://maxim-khanate.myshopify.com:443/admin/api/2023-07/variants/39859995672640/metafields.json?li...

--> 200 OK 17 (162.5ms)

[]

```

ShopifyDevSup
Shopify Staff
1453 238 525

This is an accepted solution.

Hi @sengming 

 

If the app that created the bundle didn't add any metafieds then that it may have been setup as a fixed bundle through GraphQL.

 

In that case I don't see any option to identify variants or their bundled components from the REST Admin API, but you could always use the GraphQL Admin API to verify a productVariant with a request like this:

 

query bundledVariant($id: ID!) {
node(id: $id) {
 ... on ProductVariant {
  id
  requiresComponents
  productVariantComponents(first: 3) {
   nodes {
    id
    quantity
   }
  }
 }
}
}

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

sengming
Shopify Partner
52 1 9

Thanks!

 

Just for the record, I used the official Shopify Bundles app to create the bundles https://apps.shopify.com/shopify-bundles

jinleiming
Shopify Partner
5 0 0

hello, We use graphQL ,and get the response like the following json:, so how to get the detail of nodes.id.... it isn't the original variant id of product

"node": {
"id": "gid://shopify/ProductVariant/4xxxx",
"requiresComponents": true,
"productVariantComponents": {
"nodes": [
{
"id": "gid://shopify/ProductVariantComponent/2326xxx",
"quantity": 1
},
{
"id": "gid://shopify/ProductVariantComponent/2329xxx",
"quantity": 1
}
]
}
}by

Struggling with expensive tools or poor customer support?
Try eBooster for TikTok Shop free plan: https://apps.shopify.com/ebooster-for-tiktok-shop-1
Easily sync Shopify products, inventory, and TikTok orders with minimun cost and timely support.