How can we help?

Basil Khan
Written by Basil Khan

Access bundle details using Shopify metafields

Follow the instructions below to access bundle product details using metafields in Shopify's Admin API


Every time a bundle is updated or deleted in Simple Bundles, the bundle details are automatically added as metafields on the variant in Shopify. You can view the metafields from the simple_bundles namespace and bundled_variants key. The metafields are also saved as a JSON_STRING type.

To test out the existing metafields, follow the steps below:

1. After clicking save on a bundle, right on View variant in Shopify and click on Copy Link Address.

2. Paste the link in a new tab and add `/metafields.json` to the end of the URL and click Enter.

3. You should be able to view the bundle metafield details:

4. If you are using an external service, make sure to parse the JSON string into an object or hash that can be read by your program.

5. The metafields payload is an array of objects with variant details. The following fields are available in each object via the metafields:

{
 variant_title: "Default Title",
 variant_id: 31719040385067,
 price: 64.0,
 compare_at_price: nil,
 sku: "BOD350",
 inventory_management: "shopify",
 inventory_policy: "deny",
 inventory_item_id: 33271437164587,
 handle: "biona-organic-date-syrup-350g",
 vendor: "biona",
 product_title: "Biona Organic Date Syrup (350g)",
 product_id: 4443481604139,
 quantity_in_bundle: 1
}

If you would like to access these fields on the storefront, check out this help doc: Automatically add bundle details to your Shopify store

Categories: