WP Manifestindependent plugin directory
manifest / ecommerce / wc-conditional-product-addons

WooCommerce Conditional Product Add-ons

A lightweight, fast, and professional WooCommerce plugin that allows you to add conditional product add-ons to your products with custom pricing and smart shipping calculations.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/xboxhacker/wc-conditional-product-addons/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A lightweight, fast, and professional WooCommerce plugin that allows you to add conditional product add-ons to your products with custom pricing and smart shipping calculations.

Features

✅ Conditional Logic - Show/hide add-ons based on product variation attributes ✅ Custom Pricing - Set custom prices for add-ons or use original product prices ✅ Smart Shipping - Automatically uses the largest dimensional package for shipping calculations ✅ Weight Totaling - Sums up weights of all products in cart ✅ Individual Cart Items - Each product (main + add-ons) added as separate cart items ✅ Variation Support - Full support for variable products with attribute-based conditions ✅ Clean UI - Modern, responsive interface matching your example ✅ Lightweight & Fast - Optimized code with minimal overhead

Installation

  1. Upload the Plugin

    • Upload the wc-conditional-product-addons folder to /wp-content/plugins/
    • Or zip the folder and upload via WordPress admin (Plugins > Add New > Upload Plugin)
  2. Activate

    • Go to Plugins in your WordPress admin
    • Find "WooCommerce Conditional Product Add-ons"
    • Click "Activate"
  3. Requirements

    • WordPress 5.8 or higher
    • WooCommerce 5.0 or higher
    • PHP 7.4 or higher

Usage

Setting Up Add-ons

  1. Edit a Product

    • Go to Products > Edit any product
    • Scroll down to the "Product Add-ons" meta box
  2. Add Product Add-ons

    • Click "+ Add Product Add-on"
    • Search and select the product you want to add as an add-on
    • Choose pricing:
      • Check "Use Original Product Price" to use the add-on product's regular price
      • OR enter a "Custom Add-on Price" to override the price
  3. Set Conditional Logic (Optional - For Variable Products Only)

    • Click "+ Add Condition"
    • Select an attribute (e.g., "Size")
    • Select a value (e.g., "10 inch")
    • Example: Only show the 10" subwoofer add-on when the 10" enclosure variation is selected
  4. Save

    • Publish or Update the product

How It Works for Customers

  1. Product Page

    • Customers see the main product with its variations (if applicable)
    • Below the add-to-cart button, they see "Add Components to Complete Your System:"
    • Available add-ons are displayed as checkboxes with names and prices
  2. Conditional Display

    • If the main product is variable, add-ons with conditions only appear when matching variations are selected
    • Example: Select "10 inch" enclosure → 10" subwoofer checkbox appears
  3. Adding to Cart

    • Customer selects desired add-ons
    • Clicks "Add to Cart"
    • Main product AND each selected add-on are added as separate cart items
    • Custom prices (if set) are applied to add-ons
  4. Shipping Calculation

    • The plugin automatically:
      • Sums the weight of all products
      • Uses the largest dimensional package among all products
      • Passes this data to your shipping plugin for accurate rate calculations

Example Use Case

Selling Subwoofer Enclosures with Add-ons:

Main Product: Bronco Subwoofer Enclosure (Variable Product)

  • Variations: 8" Box, 10" Box, 12" Box

Add-on Products:

  1. Rear Panel Speaker Grill - $50.00 (always available)
  2. Kicker 10" CompRT Sub - $159.95 (only with 10" or 12" box)
  3. Kicker Key500.1 Mono Amp - $269.95 (always available)
  4. Kicker Amp Remote Control Knob - $39.95 (only when amp is selected)

Setup:

  1. Create the main enclosure product with variations
  2. Add each add-on product in the "Product Add-ons" section
  3. Set conditions:
    • 10" Subwoofer: Show when attribute_size = "10-inch" OR "12-inch"
    • Rear Grill: No conditions (always shown)
    • Amp: No conditions (always shown)
    • Remote Knob: No conditions (but you could make it conditional on amp if desired)

Advanced Features

Drag & Drop Reordering

  • Reorder add-ons by dragging the handle (☰) icon
  • Order determines display order on the frontend

Custom Prices vs Original Prices

  • Use Original Price: Add-on uses its regular WooCommerce product price
  • Custom Price: Override with a special bundle/add-on price

Smart Shipping Integration

The plugin stores shipping data in the session:

WC()->session->get('wcca_shipping_dimensions')

This includes:

  • length: Maximum length among all products
  • width: Maximum width among all products
  • height: Maximum height among all products
  • weight: Sum of all product weights

Your shipping plugin can access this data for accurate calculations.

Styling & Customization

Custom CSS

Add custom styles to match your theme:

/* Change add-on wrapper background */
.wcca-addons-wrapper {
    background: #ffffff;
    border: 2px solid #000;
}

/* Style checked add-ons */
.wcca-addon-item:has(.wcca-addon-checkbox:checked) {
    border-color: #your-brand-color;
    background: #your-light-color;
}

Template Overrides

Copy templates from plugins/wc-conditional-product-addons/templates/ to your-theme/woocommerce/wcca/ to customize:

  • frontend-addons.php - Main add-ons display
  • admin-addon-meta-box.php - Admin interface
  • admin-addon-row.php - Individual add-on configuration
  • admin-condition-row.php - Condition rule display

Hooks & Filters

Filters

Modify add-on display:

add_filter('wcca_addon_display_price', function($price, $addon, $product) {
    // Modify the displayed price
    return $price;
}, 10, 3);

Modify shipping dimensions:

add_filter('wcca_shipping_dimensions', function($dimensions, $package) {
    // Customize dimension calculations
    return $dimensions;
}, 10, 2);

Actions

After add-on is added to cart:

add_action('wcca_addon_added_to_cart', function($addon_product_id, $cart_item_key, $parent_key) {
    // Custom logic after add-on is added
}, 10, 3);

Troubleshooting

Add-ons Not Showing

  • Ensure WooCommerce is active
  • Check that add-on products exist and are published
  • For variable products, verify variation attributes match condition settings

Prices Not Updating

  • Clear WooCommerce cart cache
  • Check if "Use Original Price" is correctly set
  • Verify custom price is a valid number

Conditional Logic Not Working

  • Ensure attribute names match exactly (case-sensitive)
  • Check that variation has the required attribute
  • Verify JavaScript is loading (check browser console for errors)

Shipping Issues

  • Ensure your shipping plugin supports custom dimensions
  • Verify products have dimensions and weights set
  • Check if shipping plugin is reading from WC()->session->get('wcca_shipping_dimensions')

Support

For support, feature requests, or bug reports:

  1. Check the documentation above
  2. Review the code comments for developer guidance
  3. Contact your developer or WordPress support

Changelog

Version 1.0.0

  • Initial release
  • Conditional product add-ons
  • Custom pricing support
  • Smart shipping calculations
  • Variable product support
  • Drag & drop reordering
  • Responsive design

Credits

Developed for William's Jeep aftermarket business.

License

This plugin is proprietary software. All rights reserved.