WordPress at Your Fingertips
function is not described

WC_Product_Variable::variation_is_available() private WC 1.0

Check if a given variation is currently available.

{} It's a method of the class: WC_Product_Variable{}

Return

true|false. True if the variation is available, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->variation_is_available( $variation );
$variation(WC_Product_Variation) (required)
Variation to check.

Code of WC_Product_Variable::variation_is_available() WC 5.6.0

private function variation_is_available( WC_Product_Variation $variation ) {
	// Hide out of stock variations if 'Hide out of stock items from the catalog' is checked.
	if ( ! $variation || ! $variation->exists() || ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $variation->is_in_stock() ) ) {
		return false;
	}

	// Filter 'woocommerce_hide_invisible_variations' to optionally hide invisible variations (disabled variations and variations with empty price).
	if ( apply_filters( 'woocommerce_hide_invisible_variations', true, $this->get_id(), $variation ) && ! $variation->variation_is_visible() ) {
		return false;
	}

	return true;
}