Bundles - display and setup in WooCommerce

Modified on Fri, 5 Jun at 4:24 PM

Bundles - display and setup in WooCommerce


How bundle products from Telaris work in WooCommerce, and how to display them correctly.



TABLE OF CONTENTS




Introduction to bundle products


Bundle products (collection) in Telaris are products made up of several sub-products.

In WooCommerce, these are exported as regular products, but with metadata describing which products are included.

For the bundle to display correctly in the web shop, this must be interpreted and shown explicitly.


Tips: Without customisation, bundles look like regular products in WooCommerce.



Walkthrough of bundle products


Below you can see how bundles work technically and how they are displayed.


Guide: Product types and variants in the WooCommerce integration



How bundles are exported


Bundles are exported as:

  • Simple product in WooCommerce
  • With metadata containing sub-products

Metadata is stored in the field:

  • _my_bundle_items

This contains information about:

  • Product ID
  • Quantity


NOTE: WooCommerce does not display this metadata automatically.



How the display works


For the customer to see which products are included in the bundle, this must be shown via:

  • Plugin (bundle plugin)
  • Or your own customisation (code)

Without this, the bundle appears as a regular product without details.



Setting up the display in WooCommerce


A simple way to display bundle contents is to use a code snippet in WooCommerce.

We recommend the plugin Code Snippets.

Add the following code:

add_action('woocommerce_single_product_summary', function () {
    if (!is_product()) return;

    global $product;
    if (!$product) return;

    $items = get_post_meta($product->get_id(), '_my_bundle_items', true);

    if (empty($items) || !is_array($items)) return;

    echo '<div class="my-bundle-contents">';
    echo '<h3>In this bundle</h3><ul>';

    foreach ($items as $item) {
        $pid = isset($item['product_id']) ? (int)$item['product_id'] : 0;
        $qty = isset($item['qty']) ? (int)$item['qty'] : 1;

        if ($pid <= 0) continue;

        $child = wc_get_product($pid);
        if (!$child) continue;

        echo '<li>';
        echo '<a href="' . get_permalink($pid) . '">' . esc_html($child->get_name()) . '</a>';
        echo ' × ' . $qty;
        echo '</li>';
    }

    echo '</ul></div>';
}, 35);


NOTE: This is a customisation in WooCommerce, not part of Telaris.



Common problems with bundles


If bundles do not display correctly, check:

  • Missing plugin or code for display
  • Sub-products have not been exported
  • Metadata is missing


NOTE: The price for the bundle is set manually in Telaris and is not calculated automatically.








Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article