• Resolved lukaszkomar

    (@lukaszkomar)


    There seem to be an issue with the bookable products.
    The bookable products added to the wishlist are correctly stored in the cookie but they are not displayed in the list.

    The mentioned products seem not to pass the test for VALID PRODUCTS placed in the class.yith-wcwl.php file. It’s a strange behavior because this test simply checks if the products stored in the whishlist’s cookie are published (right?)..

    I have out commented the line which filters the products for validity and it works fine – but this way there is a possibility that a product which is not published any more (its status has been changed) stays in the whishlist..

    Is there any other way to fix this then the mentioned solution?

    I’m using the free version of the plugin.

    includes/class.yith-wcwl.php :: line 575:

    $valid_products = wc_get_products( array(
    ‘status’ => ‘publish’,
    ‘include’ => $items,
    ‘limit’ => -1,
    ‘return’ => ‘ids’
    ) );

    if( empty( $valid_products ) ){
    //return array();
    }

    foreach( $wishlist as $key => $cookie ){
    if( in_array( $cookie[‘prod_id’], $hidden_products ) ){
    unset( $wishlist[ $key ] );
    continue;
    }

    if( ! in_array( $cookie[‘prod_id’], $valid_products ) ){
    //unset( $wishlist[ $key ] );
    continue;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hello there,

    I hope you’re doing well ??

    About your question:

    Yes, the code you sent me only retrieve the products that have stored in the cookie and the status is “publish”

    Maybe the booking products have a distinct status and for this reason the products are not showed. I suggest you to check about booking status product that have saved in the cookie.

    Unfortunately I cannot test it directly because I don’t have a copy of WooCommerce Bookings and the plugin is not available on www.ads-software.com repository.

    I hope this helps you.

    If you have any other questions, don’t hesitate to contact us, we’ll be happy to help you.

    Thread Starter lukaszkomar

    (@lukaszkomar)

    Thank you very much for your answer.

    I checked the status and compared the structure of the DB posts related to the simple products and related products. They were the same….

    After that I found out that

    wc_get_products

    is returning bookable products not without

    `’type’ =>’booking’ in the $args’.

    maybe you can add the type in the next version?

    Best regards

    Thread Starter lukaszkomar

    (@lukaszkomar)

    In my case:

    includes/class.yith-wcwl.php :: line 575:

    $valid_products = wc_get_products( array(
    				    'status' => 'publish',
    					'type' => array ('external', 'grouped', 'simple', 'variable', 'booking', 'accommodation-booking'),
    				    'include' => $items,
    				    'limit' => -1,
    				    'return' => 'ids'
    			    ) );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Bookable products issue / Woocommerce Bookings Plugin’ is closed to new replies.