Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4525382
i have an issue with WPC Composite Products plugin on my wordpress webiste
Open

Comments

  • Ibrahim started the conversation

    Subject: Fatal error when adding a composite product to cart (WPC Composite Products 7.6.6 + WooCommerce 10.3.6)

    Hi,

    I’m experiencing a fatal error when trying to add a composite product (Smart composite) to the cart using WPC Composite Products.

    Here are the details:

    – Site: luxorpremiumcoffee.com
    – WordPress version: 6.9.0
    – WooCommerce version: 10.3.6
    – WPC Composite Products version: 7.6.6 (free)
    – Other WPC plugins: WPC Product Bundles (active)
    – Theme: TheGem + Elementor
    – AJAX add to cart in theme: disabled
    – WooCommerce “Redirect to cart after successful addition”: enabled
    – WooCommerce stock management: enabled under WooCommerce → Settings → Products → Inventory

    What works:
    – Adding normal simple products to the cart works fine.
    – Cart and checkout pages work correctly with simple products.

    What fails:
    – When I add the composite product to the cart from the single product page, I immediately get “There has been a critical error on this website” and the request returns HTTP 500.
    – This only happens with the Smart composite product created by WPC Composite Products.

    How the composite product is configured:

    Product data: Smart composite

    Components:
    1) Component 1 – Hot chocolate
       – Source: Products
       – Selected product: one simple product (hot chocolate 250g, published)
       – Required: Yes
       – Default quantity: 1
       – Custom quantity: No
       – Multiple selection: No
       – New price: (left empty)

    2) Component 2 – Sahlab
       – Source: Products
       – Selected product: one simple product (sahlab 250g, published)
       – Required: Yes
       – Default quantity: 1
       – Custom quantity: No
       – Multiple selection: No
       – New price: (left empty)

    3) Component 3 – Turkish coffee
       – Source: Products
       – Selected products: 6 simple products (different types of Turkish coffee, all published and purchasable)
       – Required: Yes
       – Default quantity: 1
       – Custom quantity: No
       – Multiple selection: No
       – New price: (left empty)

    Pricing section for the composite:
    – Pricing mode: Exclude base price (Include base price is unchecked)
    – Discount: empty (0%)
    – Same products: default
    – Shipping fee: Apply to both composite & component

    WPC Composite Products general settings (main ones):
    – Calculate product prices: from Regular price
    – Exclude unpurchasable: Yes
    – Change price: Yes
    – Cart content count: Composite only
    – Hide component products on cart & checkout page: Yes, but list component sub-product names under the main composite in separate lines

    Steps to reproduce:

    1. Open the composite product on the frontend.
    2. Select one coffee product from the 6 Turkish coffee options in the component.
    3. Click “Add to cart”.
    4. The page shows “There has been a critical error on this website”.
    5. In the browser Network tab, the POST to the product URL returns status 500.
    6. Simple products still add to cart without any problem.

    Error log from wp-content/debug.log:

    [11-Dec-2025 01:25:45 UTC] PHP Warning: Undefined array key "data" in /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 729
    [11-Dec-2025 01:25:45 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_stock_managed_by_id() on null in /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-cart.php:730
    Stack trace:
    #0 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1279): WC_Cart->get_cart_item_quantities()
    #1 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/wpc-composite-products/includes/class-wooco.php(2173): WC_Cart->add_to_cart()
    #2 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/wpc-composite-products/includes/class-wooco.php(2114): WPCleverWooco->add_to_cart_items()
    #3 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-includes/class-wp-hook.php(341): WPCleverWooco->add_to_cart()
    #4 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
    #5 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-includes/plugin.php(522): WP_Hook->do_action()
    #6 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1343): do_action()
    #7 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php(874): WC_Cart->add_to_cart()
    #8 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php(846): WC_Form_Handler::add_to_cart_handler_simple()
    #9 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-includes/class-wp-hook.php(341): WC_Form_Handler::add_to_cart_action()
    #10 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
    #11 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-includes/plugin.php(522): WP_Hook->do_action()
    #12 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-settings.php(764): do_action()
    #13 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-config.php(216): require_once('/home/u79503109...')
    #14 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-load.php(50): require_once('/home/u79503109...')
    #15 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/wp-blog-header.php(13): require_once('/home/u79503109...')
    #16 /home/u795031091/domains/luxorpremiumcoffee.com/public_html/index.php(17): require('/home/u79503109...')
    #17 {main}

    It looks like the composite plugin is adding a cart item without a valid “data” (WC_Product) entry, which causes WooCommerce to crash when it tries to call get_stock_managed_by_id() on null.

    Could you please check if this is a known issue with WPC Composite Products and WooCommerce 10.3.x, and let me know if there is a patch, a workaround, or a specific configuration I should change to avoid this fatal error?

    Thanks in advance.