Accessing bundles from storefront API

sj1234
New Member
9 0 0

Hi,

I am new to shopify and have a doubt. Is it possible to access the custom bundles(created by some bundles app) via the storefront API? Is the bundle created a new standalone product or different?

Replies 5 (5)

martinfotp
Shopify Partner
24 4 15

Yes but it may depend on the app you’re using. We use the Bundles app. All the app does is sync inventory based on bundle rules. A bundle is just a product variant so is accessed in the same manner as any other product variant. 

Vrea
Shopify Partner
2 0 0

Thanks for your answer! Is it possible to access the bundle data from the Storefront API?

PaulNewton
Shopify Partner
6274 573 1319

@Vrea wrote:

access the bundle data from the Storefront API?


Either your accessing only the product as if it where any other productVariant on the api like any other.

Or what you mean by bundle "data" is the data contained in a third party app itself in which case you have to contact that third party apps developers on how to get any internal data generated by that app.

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


Vrea
Shopify Partner
2 0 0

Yes, I mean the data that is contained in the bundle app. So the Storefront API do not expose any data from third party apps?

martinfotp
Shopify Partner
24 4 15

Hello Vrea

 

The bundles app syncs inventory between products/variants, it does not create the product / variants used for bundles. It is purely an inventory management app for bundles.

 

From the app Readme:

 

When you're selling combinations of multiple products you can link them to the separate products or variants. Selling single shirts and also a multipack of the same product? Create a bundle with Bundles and keep your inventory up to date. And when part of the bundle is sold out the app will make sure the bundle shows as sold out as well.

 

Bundles is also the go to app when you're selling products made of different components. With Bundles you can track the inventory for the components easily.

 

Bundles checks and syncs the products/variants in a bundle after each sale. It takes about a minute to get all the other products/variants back in sync. Bundles does not create products or variants in your store, it lets you link several products to one.

So in that sense, there is no additional data to expose via the Storefront API as it is using the normal Shopify products and variants. 

 

If you can explain a little more about what you're looking to do, maybe there's a more appropriate app / better solution. 

 

EDIT: Looking in the bundles app support, then this might be possible to expose the bundle data via a metafield, which might do what you want:

 

Want to show child items under each bundle in your orders?

There are several options, I can enable metafields for the bundles so that you can use that to show the components in your product template and you can also use it for line item properties. If you want me to enable the metafields, please send an email to bundles@gaze.bo



Once they've enabled the metafield, you'd need to expose the metafield to the Storefront. This can either be done via the GraphQL Admin API or using an app like Metafield Guru (I would recommend this app):

 

https://support.metafields.guru/support/solutions/articles/44002187210-how-to-expose-metafields-to-t...

https://shopify.dev/custom-storefronts/products/metafields#expose-metafields

 

Once the metafields have been exposed on the Product, then they can be queried via the Storefront API something like the following:

 

query {
  productByHandle(handle: "amazing-frozen-pizza") {
    pizzaSizeInches: metafield(namespace: "testapp", key: "pizza-size-inches") {
      value
      type
    }
    expirationDate: metafield(namespace: "testapp", key: "expiration-date")
      value
      type
    }
  }
}