Bundles, add-ons and "frequently bought together"
Three sales modules: bundles, product add-ons and “frequently bought together” (FBT). Each works independently.
Product bundles
Section titled “Product bundles”The bundles module allows creating configurable product sets with a shared discount. The customer purchases a bundle as a single product, and the individual components are visible in the order details.
Configuration
Section titled “Configuration”Go to WooCommerce > Settings > Polski PRO > Bundles and enable the module (option polski_bundles).
| Setting | Default value | Description |
|---|---|---|
| Enable bundles | No | Activates the bundle functionality |
| Discount type | Percent | percent (percentage) or fixed (fixed amount) |
| Default discount | 10% | Discount applied to new bundles |
| Show savings | Yes | Displays the savings amount to the customer |
Creating a bundle
Section titled “Creating a bundle”- Go to Products > Add New
- In the Product data section, select the “Polski PRO Bundle” type
- In the Bundle components tab, add products
- Set the quantity for each component
- Configure the discount (overrides the default)
Discount calculation
Section titled “Discount calculation”The bundle price is calculated automatically:
Cena pakietu = Suma cen składników - Rabat
Przykład (rabat 15%):Produkt A: 100 zł x 1 = 100 złProdukt B: 50 zł x 2 = 100 złSuma: 200 złRabat (15%): 30 złCena pakietu: 170 złIf a bundle component is on sale, the sale price is used in the calculations.
Bundle shortcode
Section titled “Bundle shortcode”[polski_bundle product_id="456" show_savings="yes" layout="grid"]| Parameter | Required | Description |
|---|---|---|
product_id | Yes | Bundle product ID |
show_savings | No | Display savings amount (yes/no) |
layout | No | Layout: grid, list, compact |
Bundle hooks
Section titled “Bundle hooks”/** * Filtruje obliczoną cenę pakietu. * * @param float $bundle_price Obliczona cena pakietu * @param array $items Składniki pakietu z cenami * @param float $discount Wartość rabatu */apply_filters('polski_pro/bundles/price', float $bundle_price, array $items, float $discount): float;Example - minimum bundle price:
add_filter('polski_pro/bundles/price', function (float $bundle_price, array $items, float $discount): float { $minimum_price = 49.99; return max($bundle_price, $minimum_price);}, 10, 3);/** * Akcja wywoływana po dodaniu pakietu do koszyka. * * @param string $cart_item_key Klucz pozycji w koszyku * @param int $bundle_id ID produktu-pakietu * @param array $items Składniki pakietu */do_action('polski_pro/bundles/added_to_cart', string $cart_item_key, int $bundle_id, array $items);Product add-ons
Section titled “Product add-ons”The add-ons module allows displaying optional upsell products directly on the product page. The customer can select additional products and purchase them with a single click alongside the main product.
Configuration
Section titled “Configuration”Go to WooCommerce > Settings > Polski PRO > Add-ons and enable the module (option polski_addons).
| Setting | Default value | Description |
|---|---|---|
| Enable add-ons | No | Activates the add-on functionality |
| Display position | After cart button | Where to display the add-ons section |
| Section heading | ”Dodaj do zamówienia” | Heading text above the add-on list |
| Maximum count | 5 | Limit of add-ons displayed per product |
Assigning add-ons
Section titled “Assigning add-ons”Add-ons are configured in the product editor, in the Polski PRO Add-ons tab:
- Click “Add add-on”
- Select a product from the catalog
- Set the add-on price (defaults to the product price)
- Optionally set a promotional add-on price
- Set the display order
Add-ons can have a different price than the source product - this allows offering special “with product” pricing.
Selection validation
Section titled “Selection validation”The module validates:
- Stock availability of each selected add-on
- Price correctness (whether they were not modified client-side)
- Quantity limits
Add-on hooks
Section titled “Add-on hooks”/** * Filtruje listę dodatków dla produktu. * * @param array $addons Tablica dodatków z cenami * @param \WC_Product $product Produkt główny */apply_filters('polski_pro/addons/items', array $addons, \WC_Product $product): array;Example - filtering add-ons based on user role:
add_filter('polski_pro/addons/items', function (array $addons, \WC_Product $product): array { if (current_user_can('wholesale_customer')) { foreach ($addons as &$addon) { $addon['price'] = $addon['price'] * 0.8; // 20% rabatu hurtowego } } return $addons;}, 10, 2);Frequently bought together
Section titled “Frequently bought together”The recommendations module displays products most frequently purchased together with the viewed product, with the ability to add multiple products to the cart with a single click.
Configuration
Section titled “Configuration”Go to WooCommerce > Settings > Polski PRO > Frequently bought together and enable the module (option polski_fbt).
| Setting | Default value | Description |
|---|---|---|
| Enable module | No | Activates recommendations |
| Data source | Manual | manual or auto (based on order history) |
| Product limit | 3 | Maximum number of recommended products |
| Section heading | ”Często kupowane razem” | Section heading text |
| Position | Below short description | Where to display the section |
Manual assignment
Section titled “Manual assignment”In the product editor, Frequently bought together tab:
- Search and add related products
- Set the display order
- Optionally set a discount for purchasing together
Automatic recommendations
Section titled “Automatic recommendations”When the data source is set to auto, the module analyzes order history and identifies products most frequently purchased together. The analysis runs once daily via WP-Cron.
Adding to cart
Section titled “Adding to cart”The “Frequently bought together” section displays:
- Checkboxes next to each recommended product
- Thumbnails and product names
- Individual product prices
- Total price of selected products
- “Add all to cart” button
The customer checks the desired products and adds them with a single click. All products are added to the cart as separate items.
Shortcode
Section titled “Shortcode”[polski_fbt product_id="789" limit="4" show_prices="yes"]| Parameter | Required | Description |
|---|---|---|
product_id | No | Main product ID (defaults to current) |
limit | No | Maximum number of recommendations |
show_prices | No | Display prices (yes/no) |
FBT hooks
Section titled “FBT hooks”/** * Filtruje listę rekomendowanych produktów. * * @param array $product_ids Tablica ID rekomendowanych produktów * @param int $product_id ID produktu głównego * @param string $source Źródło: 'manual' lub 'auto' */apply_filters('polski_pro/fbt/products', array $product_ids, int $product_id, string $source): array;Example - excluding products from a specific category:
add_filter('polski_pro/fbt/products', function (array $product_ids, int $product_id, string $source): array { $excluded_category_id = 42; return array_filter($product_ids, function (int $id) use ($excluded_category_id): bool { return ! has_term($excluded_category_id, 'product_cat', $id); });}, 10, 3);Module interplay
Section titled “Module interplay”All three modules can work simultaneously on the same product:
- A bundle with assigned add-ons and a frequently bought together section
- Bundle components can have their own add-ons
- FBT recommendations can point to bundles
The display order on the product page is configurable via WooCommerce hook priorities.
Troubleshooting
Section titled “Troubleshooting”Bundle price does not update after changing component prices The bundle price is calculated dynamically. Clear the Object Cache and WooCommerce transients.
Add-ons do not display on the product page
Check if the theme supports the woocommerce_after_add_to_cart_button hook. Some custom themes skip standard WooCommerce hooks.
Automatic recommendations are empty
The module needs historical data - automatic recommendations appear after collecting a sufficient number of orders. Check if the polski_pro_fbt_analyze WP-Cron task is scheduled.
Next steps
Section titled “Next steps”- Report issues: GitHub Issues
- Related modules: Pre-orders, Catalog mode