woocommerce_is_purchasable

woocommerce_is_purchasable

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.7.1

apply_filters('woocommerce_is_purchasable') is found 3 times:

  • /includes/abstracts/abstract-wc-product.php line 1670
    1666
    1667
    1668
    1669
    1670
    1671
    1672
    1673
    1674
    1675
    1676
         * @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 );
    }
     
    /**
     * Returns whether or not the product is on sale.
     *
     * @param  string $context What the value is for. Valid values are view and edit.
  • /includes/class-wc-product-external.php line 153
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    * @access public
     * @return bool
     */
    public function is_purchasable() {
        return apply_filters( 'woocommerce_is_purchasable', false, $this );
    }
     
    /**
     * Get the add to url used mainly in loops.
     *
     * @access public
  • /includes/class-wc-product-grouped.php line 84
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    *
     * @return bool
     */
    public function is_purchasable() {
        return apply_filters( 'woocommerce_is_purchasable', false, $this );
    }
     
    /**
     * Returns the price in html format.
     *
     * @param string $price (default: '').

See this hook used in plugins:

Examples using woocommerce_is_purchasable