Add MetaFields to Bundle Products
If you would like to add Bundle composition Information to your product page, app automatically adds metafields to product variants.
App will add bundle composition information when you save or update the bundle in the app. App will save this info under
Namespace : profit_bundles
Key: bundle_composition
the type of this metafield will be json.
To test out the existing metafields, follow the steps below:
- Open the bundle for which you want to test metafields by clicking on it in the bundle list.
- Click on "View Product in Shopify", app will take you to the product variant detail page in admin section. Copy and paste the url in a new tab and add '/metafields.json' to it.
- You should be able to view the bundle metafield details:
The Metafield Contain Following bundle information.
[{"id":"gid://shopify/ProductVariant/47181247119655","title":"Arabica Coffee - 60% Vegan Dark Chocolate - Stevia Sweetened - 100G Bar","composition":1,"price":"1598.00"},{"id":"gid://shopify/ProductVariant/47181247152423","title":"Pecan Nut - 60% Vegan Dark Chocolate - Stevia Sweetened - 100 G Bar","composition":1,"price":"1598.00"},{"id":"gid://shopify/ProductVariant/47181247021351","title":"Zesty Orange - 60% Vegan Dark Chocolate - Stevia Sweetened - 100G Bar","composition":1,"price":"225.00"}]
To access this json value in your product liquid template, shopify recommends following way.
Creating and Updating
App creates these metafields on the product variant that represents the bundle in your shopify store. These are created when a bundle is saved in a published state. When you update a bundle in the published state then these metafields are also updated as per changes in your bundle's composition.
Publishing and Unpublishing
Please note when you unpublish the bundle in the app, app will remove this metafield from the product variant and will be re added once you publish the bundle again.