• Hey there,

    I am pretty sure you can add non-products to wishlists, however I am unable to find the right function call.

    I tried:

    $yith = new YITH_WCWL_Wishlist();
        $x = $yith->add_product(3052);

    where 3052 is a post type page however it fails because the add_product method checks

    $product = wc_get_product( $product_id );
    
    if( ! $product || $this->has_product( $product_id ) ){
    	return false;
    }

    which fails, what is the right way to add a non-product to the wishlist

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

    (@yithemes)

    Hi Mat

    Unfortunately, this is no longer possible since version 3.0
    Due to the additional features that we introduced with that release, we had to include cheks that prevents users from adding non-product items to their wishlist

    I suppose that we could introduce back this possibility, maybe as an edge case, but for the moment we’re focusing on WooCommerce products only
    Could you please describe your use case? I’m interested in understanding what scenarios could require non-product wishlists

    That’s quite unfortunate. I had spoken to someone in your chat last week and they said this was possible. I only came here because chat was closed.

    Client wants the ability to add “requests for products that do no exist” to the wish list and instead of making it a product and then filtering it out of every other woo query, which i am not sure is even possible I was going to use a custom post type.

    Plugin Author YITHEMES

    (@yithemes)

    Hi again

    I’m sorry for the misleading information we provided; I’ll review this case with Customer Care team, to improve our services

    Regarding your use case, I could suggest to create a custom product (maybe with a specific prouct type) and then exclude it from shop queries using this filter: woocommerce_product_query
    You’ll get WP_Query object for products loop, so you should be able to add post__not_in parameter, as documented here

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add a non woocommerce product to wishlist?’ is closed to new replies.