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

Okay
  Public Ticket #4572658
Bug in WPC Product Bundles 8.5.7 – add_to_cart_validation fails without WPML
Open

Comments

  •  4
    gify started the conversation

    Hello WPClever Support Team,

    I am experiencing a critical bug in WPC Product Bundles Premium version 8.5.7 that prevents customers from adding bundles to the cart on my WooCommerce shop (raupen-kaufen.de).

    **Problem:**
    Customers receive the error message "You cannot add this bundle to the cart" when clicking "Add to Cart" on bundle product pages. The error affects all bundle products. The issue has been occurring for approximately one week.

    **Key finding:**
    After extensive debugging, I identified the root cause in the add_to_cart_validation() method in class-woosb.php:

    The woosb_ids hidden input field on the product page contains values in the new format with random keys, for example:
    597/tmv9/1/,598/3ghc/1/,18486/6hj1/1/

    During validation, the code compares $key from the submitted items against $ori_items[$key]. This comparison fails because the random keys (tmv9, 3ghc, 6hj1) generated by generate_key() at page render time do not match the keys in $ori_items when get_items() is called fresh during validation.

    **Proof that this is a version 8.5.7 bug:**
    I run two identical WooCommerce shops:
    - raupen-kaufen.de (without WPML) → bundle add-to-cart FAILS
    - buy-butterflies.com (with WPML) → bundle add-to-cart WORKS

    The reason is that in class-woosb.php, the validation block is wrapped in:
    if ( ! function_exists( 'wpml_loaded' ) ) { ... }

    This means the validation is completely skipped on the WPML site, which is why it works there.

    **Environment:**
    - WPC Product Bundles Premium: 8.5.7
    - WooCommerce: 10.9.1
    - WordPress: latest
    - PHP: current SiteGround version
    - Affected bundle example: Product ID 596, woosb_ids = 597/1,598/1,18486/1

    **Request:**
    Please fix the key-matching logic in add_to_cart_validation() so that the submitted woosb_ids keys are correctly matched against the original items regardless of whether WPML is active.

    This is causing significant revenue loss as customers cannot purchase our products.

    Thank you for your urgent attention to this matter.

    Best regards,
    Patrick 
    raupen-kaufen.de

  •  1,705
    Dustin replied

    Hi Gify,

    Thank you for sending me the detailed error information.

    However, the following statement is incorrect.

    During validation, the code compares $key from the submitted items against $ori_items[$key]. This comparison fails because the random keys (tmv9, 3ghc, 6hj1) generated by generate_key() at page render time do not match the keys in $ori_items when get_items() is called fresh during validation.

    Our plugin will retrieve the exact product key for accurate display and verification. This prevents users from adding other products (by editing elements in the browser) to the bundle to receive discounts.

    7574394179.png

    You can check this product https://demo.wpclever.net/woosb/product/smart-bundle-04/ to see that those keys haven't changed.

    I see that you purchased the plugin 3 years ago. Therefore, there might be compatibility issues with outdated data. You could try editing the bundle, re-adding the products, and saving. This process will save the new key and ensure that the bundle verification process when adding to the cart works correctly.

    Best regards,
    Dustin