• Hello,

    Once again we have the problem that we can no longer add bundles to the shopping cart. I have therefore taken a closer look at the source code for this in our test system. In our frontend, the shopping cart button in the product displays this:

    <input name="woosb_ids" class="woosb-ids woosb-ids-11618" type="hidden" value="6346/qnxq/1/,3747/w6px/1/,7623/f8vi/1/">

    The output is generated in the file class-woosb.php.

    As soon as you want to add the bundle to the shopping cart, this section is executed in the function “add_to_cart_validation” in the same file:

    // get original items for validate
    $ori_items = $product->get_items();
    $ori_ids = array_filter( array_column( $ori_items, 'id' ) );

    if ( isset( $_REQUEST['woosb_ids'] ) ) {
    $ids = WPCleverWoosb_Helper()->clean_ids( $_REQUEST['woosb_ids'] );
    $product->build_items( $ids );
    }

    if ( ( $items = $product->get_items() ) && ! empty( $items ) ) {

    Above, the components are retrieved from the product object using get_items() and saved as originals. The array has random values as keys. Below, the above field is read and the item array is recreated using build_items(). This gives each entry a new random key. At the bottom, this item array is now retrieved for further use.

    Then there is a check a little further down:

    if ( ! isset( $ori_items[ $key ] ) || ( ! in_array( $_id, $ori_ids ) && ! in_array( $_parent, $ori_ids ) ) ) {
    wc_add_notice( esc_html__( 'You cannot add this bundle to the cart.', 'woo-product-bundle' ), 'error' );

    return false;
    }

    Since the requested key from the original item no longer exists, you can never add a bundle to the shopping cart. And the reason for this is the HTML element mentioned above.

    Question 1: Why is the above HTML element displayed in the frontend at all? Is it possible to do without it, and if so, how?
    Question 2: What is the reason for this procedure with the random keys?

    Please note: the products in the bundle are all visible and can be purchased individually. We experience this problem with all bundles with different configurations.

    As the plugin is currently structured, it is unfortunately not usable for us. An answer to the above insight would therefore be very nice.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Janilyn T

    (@janilyn409)

    Hi @threadi ,

    Thanks for the detailed feedback. I will send this to our developers.

    I will try to reach back to you right when receiving any response from our developers.

    Best regards.

    I would also like to know the answer to this as I have the same issue.

    • This reply was modified 3 weeks, 2 days ago by ozviewer.
    Thread Starter threadi

    (@threadi)

    I updated to the now released version 8.1.1. Unfortunately, that doesn’t solve the problem.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.