- Structure
- Liquid Section
- FoxSell JS Object
- Storefront API
Fixed Bundle Configuration Metaobject
Hide fields
Hide fields
ID of the bundle within the app
List of product properties containing information about each product in the bundle
Show format
Show format
List of product references included in the bundle
Add this snippet as a section in your theme to see the values of the metafieldNote: The
namespace and key are constant for all storesCopy
{% liquid
assign app_namespace = 'app--67872686081'
assign fixed_bundle_config = product.metafields[app_namespace].fixed_bundle_config.value
assign bundle_id = fixed_bundle_config.bundle_id.value
assign product_properties = fixed_bundle_config.product_properties.value
assign products = fixed_bundle_config.products.value
%}
<p><strong>Bundle ID</strong>: {{ bundle_id }}</p>
<p><strong>Product Properties</strong></p>
{{ product_properties | json }}
<p><strong>Products in Bundle:</strong></p>
{% for product_prop in product_properties %}
{% assign product_id = product_prop.product_id | times: 1 %}
{% assign product = products | where: 'id', product_id | first %}
{% if product %}
<div style="border: 1px solid #ccc; padding: 10px; margin: 10px 0;">
<p><strong>Product Title:</strong> {{ product.title }}</p>
<p><strong>Product ID:</strong> {{ product_prop.product_id }}</p>
<p><strong>Quantity in Bundle:</strong> {{ product_prop.quantity }}</p>
<p><strong>Selected Variants:</strong></p>
{% for variant_id in product_prop.selected_variant_ids %}
{% assign var_id = variant_id | times: 1 %}
{% assign selected_variant = product.variants | where: 'id', var_id | first %}
{% if selected_variant %}
<div style="margin-left: 20px;">
<p>- {{ selected_variant.title }} ({{ selected_variant.price | money }})</p>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% schema %}
{
"name": "FoxSell Fixed Bundle Test",
"settings": [],
"presets": [
{
"name": "FoxSell Fixed Bundle Test"
}
]
}
{% endschema %}
Add this snippet in your
liquid file to access bundle config via window.foxsell objectNote: The namespace and key are constant for all storesCopy
{% liquid
assign app_namespace = 'app--67872686081'
assign fixed_bundle_config = product.metafields[app_namespace].fixed_bundle_config.value
assign bundle_id = fixed_bundle_config.bundle_id.value
assign product_properties = fixed_bundle_config.product_properties.value
assign products = fixed_bundle_config.products.value
%}
<script>
window.foxsell = window.foxsell || {};
window.foxsell.bundleConfig = {
id: "{{ bundle_id }}",
products: {{ products | json }},
productProperties: {{ product_properties | json }}
}
</script>
Use the Shopify Storefront API to query the metafields namespace containing your bundle configuration.Note: The
namespace and key are constant for all storesCopy
fragment Product on Product {
id
title
handle
fixed_bundle_config: metafield(
namespace: "app--67872686081"
key: "fixed_bundle_config"
) {
id
namespace
key
value
type
reference {
... on Metaobject {
id
handle
type
fields {
key
type
value
references(first: 30) {
nodes {
... on Product {
id
handle
title
variants(first: 100) {
nodes {
id
title
price {
amount
currencyCode
}
}
}
}
}
}
}
}
}
}
}