woocommerce_variation_is_purchasable filter-hookWC 3.0.0

Filter to adjust if a variation is purchasable.

Usage

add_filter( 'woocommerce_variation_is_purchasable', 'wp_kama_woocommerce_variation_is_purchasable_filter', 10, 2 );

/**
 * Function for `woocommerce_variation_is_purchasable` filter-hook.
 * 
 * @param bool   $purchasable If the variation is purchasable.
 * @param object $variation   The variation object.
 *
 * @return bool
 */
function wp_kama_woocommerce_variation_is_purchasable_filter( $purchasable, $variation ){

	// filter...
	return $purchasable;
}
$purchasable(true|false)
If the variation is purchasable.
$variation(object)
The variation object.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

WC_Product_Variation::is_purchasable()
woocommerce_variation_is_purchasable
woocommerce/includes/class-wc-product-variation.php 562
return apply_filters( 'woocommerce_variation_is_purchasable', $this->variation_is_visible() && parent::is_purchasable() && ( ProductStatus::PUBLISH === $this->parent_data['status'] || current_user_can( 'edit_post', $this->get_parent_id() ) ), $this );

Where the hook is used in WooCommerce

Usage not found.