WC_Product::get_availability_text
Get availability text based on stock status.
Method of the class: WC_Product{}
Hooks from the method
Returns
String.
Usage
// protected - for code of main (parent) or child class $result = $this->get_availability_text();
WC_Product::get_availability_text() WC Product::get availability text code WC 10.4.3
protected function get_availability_text() {
if ( ! $this->is_in_stock() ) {
$availability = __( 'Out of stock', 'woocommerce' );
} elseif ( $this->managing_stock() && $this->is_on_backorder( 1 ) ) {
$availability = $this->backorders_require_notification() ? __( 'Available on backorder', 'woocommerce' ) : '';
} elseif ( ! $this->managing_stock() && $this->is_on_backorder( 1 ) ) {
$availability = __( 'Available on backorder', 'woocommerce' );
} elseif ( $this->managing_stock() ) {
$availability = wc_format_stock_for_display( $this );
} else {
$availability = '';
}
return apply_filters( 'woocommerce_get_availability_text', $availability, $this );
}