A “Frequently Bought Together” section is a powerful eCommerce feature that increases average order value by suggesting related products.
Amazon popularized this concept, and now it can be implemented easily in WooCommerce.
In this tutorial, you will learn how to display a simple frequently bought together block using WooCommerce hooks.
Why This Feature Works So Well
Customers often need complementary products but may forget to add them to the cart.
This feature solves that problem automatically.
- Increases average order value
- Improves product discovery
- Encourages multi-product purchases
- Enhances shopping experience
The WooCommerce Hook We Will Use
We will use:
woocommerce_after_single_product_summary
This hook allows us to display additional content after the main product details.
Example Code
Add this code to your theme’s functions.php file or a custom plugin:
add_action('woocommerce_after_single_product_summary', 'frequently_bought_together_section', 15);
function frequently_bought_together_section() {
global $product;
if (!$product) {
return;
}
$related_ids = wc_get_related_products($product->get_id(), 3);
if (empty($related_ids)) {
return;
}
echo '';
echo 'Frequently Bought Together
';
echo '';
foreach ($related_ids as $id) {
$related_product = wc_get_product($id);
if (!$related_product) {
continue;
}
echo '';
}
echo '';
echo '';
}
How It Works
This function uses WooCommerce’s built-in related products system:
- Gets 3 related products automatically
- Displays them under the main product
- Creates a simple product recommendation block
Customization Ideas
- Manually define product bundles instead of related items
- Add “Add all to cart” button
- Show discount for buying multiple items
- Use AI-based recommendations instead of default related products
