• Is there are hook to be able to disable this on certain products? I need to be able to disable this on a certain category or on certain products which require additional fields.

Viewing 1 replies (of 1 total)
  • Plugin Author Varun Sridharan

    (@varunms)

    Hi There

    A new filter is introduced in V2.7.2

    And below is an example

    
    add_filter( 'wc_quick_buy_allow_render_button', 'yourprefix_block_quick_buy', 10, 3 );
    
    /**
     * @param bool        $default_status default status
     * @param \WC_Product $product current product information
     * @param bool        $is_single_product_page will be true if button is generated for single product page.
     *
     * @return bool / if true returned then button will be generated.
     */
    function yourprefix_block_quick_buy( $default_status, $product, $is_single_product_page ) {
    	// Below Condition Block Quick Buy render if its a single product page & product ID is 18
    	if ( $is_single_product_page && '18' == $product->get_id() ) {
    		return false;
    	}
    
    	// Below Condition Block Quick Buy render if its not single product page & product ID is 42
    	if ( ! $is_single_product_page && '42' == $product->get_id() ) {
    		return false;
    	}
    	return $default_status;
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Disable Hook?’ is closed to new replies.