woocommerce_is_purchasable
Returns false if the product cannot be bought.
Usage
add_filter( 'woocommerce_is_purchasable', 'wp_kama_woocommerce_is_purchasable_filter', 10, 2 );
/**
* Function for `woocommerce_is_purchasable` filter-hook.
*
* @param $false
* @param $that
*
* @return
*/
function wp_kama_woocommerce_is_purchasable_filter( $false, $that ){
// filter...
return $false;
}
- $false
- -
- $that
- -
Where the hook is called
woocommerce_is_purchasable
woocommerce_is_purchasable
woocommerce_is_purchasable
woocommerce/includes/class-wc-product-external.php 154
return apply_filters( 'woocommerce_is_purchasable', false, $this );
woocommerce/includes/abstracts/abstract-wc-product.php 1757
return apply_filters( 'woocommerce_is_purchasable', $this->exists() && ( ProductStatus::PUBLISH === $this->get_status() || current_user_can( 'edit_post', $this->get_id() ) ) && '' !== $this->get_price(), $this );
woocommerce/includes/class-wc-product-grouped.php 86
return apply_filters( 'woocommerce_is_purchasable', false, $this );