WC_Product::get_availability_text() – Get availability text based on stock status.

You appear to be a bot. Output may be restricted

Description

Get availability text based on stock status.

Usage

$string = WC_Product::get_availability_text();

Parameters

Returns

string

Source

File name: woocommerce/includes/abstracts/abstract-wc-product.php
Lines:

1 to 14 of 14
  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 );
  }
 

 View on GitHub View on Trac