WC_Product::is_purchasable()publicWC 1.0

Returns false if the product cannot be bought.

Method of the class: WC_Product{}

Hooks from the method

Return

true|false.

Usage

$WC_Product = new WC_Product();
$WC_Product->is_purchasable();

WC_Product::is_purchasable() code WC 9.7.1

public function is_purchasable() {
	/**
	 * Filters whether a product is purchasable.
	 *
	 * @since 2.7.0
	 * @param bool          $purchasable Whether the product is purchasable.
	 * @param WC_Product    $product     Product object.
	 */
	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 );
}