• Resolved dawed78

    (@dawed78)


    Hello
    How to hide the butto “add to wishlist” when the product is sold out?
    Thanks
    Greetings
    Davide

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

    (@karzin)

    Hello @dawed78,

    There isn’t a native option for that. I can think of including it later, though.
    But please, try this code in your functions.php:

    $default_btn_single_prod_position = get_option( Alg_WC_Wish_List_Settings_Buttons::OPTION_DEFAULT_BTN_SINGLE_POSITION, 'woocommerce_single_product_summary' );
    $default_btn_single_prod_priority = get_option( Alg_WC_Wish_List_Settings_Buttons::OPTION_DEFAULT_BTN_SINGLE_PRIORITY, 31 );
    remove_action( $default_btn_single_prod_position, array( Alg_WC_Wish_List_Toggle_Btn::get_class_name(), 'show_default_btn'), $default_btn_single_prod_priority );
    add_action( $default_btn_single_prod_position, function(){
    	$product_id = get_the_ID();
    	$product = wc_get_product($product_id);
    	if($product->is_in_stock()){
    		Alg_WC_Wish_List_Toggle_Btn::show_default_btn();
    	}
    },$default_btn_single_prod_priority);
    Thread Starter dawed78

    (@dawed78)

    Hello Pablo
    Thanks so much!
    It work!
    Greetings
    Davide

    Plugin Author Pablo Pacheco

    (@karzin)

    I’m glad it worked!
    Take care

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide wish list button, when sold’ is closed to new replies.