Integrating Simple Bundles with a Hydrogen Storefront
In this help document, we will guide you through the process of integrating bundles created with Simple Bundles with a Hydrogen storefront, as well as with other channels like a custom iOS or Android app that uses Shopify's storefront API. The detailed steps and code examples for the integration can be found in the project's README on GitHub.
1. Add Bundle Product Items
The first major section is about adding bundle product items to your storefront. This involves making metafields available, adding necessary permissions, and then using mutation code to expose these metafields in your product queries. Once that's done, you will need to create a component for your bundled items and reference it in your main Product component.
Here are the basic steps:
- Make metafields available by installing the Shopify GraphiQL App.
- Ensure all necessary permissions are added.
- Add mutation code inside the GraphiQL app.
- Once metafields are exposed, add them within your product queries.
- Create a component for your bundled items.
- Reference and parse the JSON of the metafield string in your main Product component.
- Add the bundleItems component expression within your main product component.
- Check bundled products with infinite options or non-bundled products to make sure the bundled items component doesn't appear where it shouldn't.
For more details, please refer to the Add Bundle Product Items section of the project's README on GitHub.
2. Add Infinite Bundle Product Select Options
The second major section covers the process of adding bundle select options for infinite options bundles. This involves exposing the necessary metafields, updating your GraphQL queries, and then creating components to display the bundled options as select fields.
Here are the basic steps:
- Expose Variant Options and Variant Options v2 Metafields in the Shopify GraphiQL App.
- Update GraphQL to import both variant options metafields within your PRODUCT_FRAGMENT query.
- Import metafield data from Shopify, parse the JSON, and pass it to child components.
- Create a component to display the bundled options as select fields.
- Update your ProductForm component to include the new component and data.
- Test the infinite bundle options to make sure the select fields show up for each product in the bundle.
For more details, please refer to the Add Infinite Bundle Product Select Options section of the project's README on GitHub.