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 $condition * @param $that * * @return */ function wp_kama_woocommerce_is_purchasable_filter( $condition, $that ){ // filter... return $condition; }
- $condition
- -
- $that
- -
Where the hook is called
woocommerce_is_purchasable
woocommerce_is_purchasable
woocommerce_is_purchasable
woocommerce/includes/abstracts/abstract-wc-product.php 1659
return apply_filters( 'woocommerce_is_purchasable', $this->exists() && ( 'publish' === $this->get_status() || current_user_can( 'edit_post', $this->get_id() ) ) && '' !== $this->get_price(), $this );
woocommerce/includes/class-wc-product-external.php 151
return apply_filters( 'woocommerce_is_purchasable', false, $this );
woocommerce/includes/class-wc-product-grouped.php 82
return apply_filters( 'woocommerce_is_purchasable', false, $this );