| @@ 612-627 (lines=16) @@ | ||
| 609 | * |
|
| 610 | * @return bool |
|
| 611 | */ |
|
| 612 | public function is_in_stock() { |
|
| 613 | $status = $this->stock_status === 'instock'; |
|
| 614 | ||
| 615 | /** |
|
| 616 | * Sanity check to ensure stock qty is not lower than 0 but still listed |
|
| 617 | * instock. |
|
| 618 | * |
|
| 619 | * Check is not required for products on backorder since they can be |
|
| 620 | * instock regardless of actual stock quantity. |
|
| 621 | */ |
|
| 622 | if ( $this->managing_stock() && ! $this->backorders_allowed() && $this->get_total_stock() <= get_option( 'woocommerce_notify_no_stock_amount' ) ) { |
|
| 623 | $status = false; |
|
| 624 | } |
|
| 625 | ||
| 626 | return apply_filters( 'woocommerce_product_is_in_stock', $status ); |
|
| 627 | } |
|
| 628 | ||
| 629 | /** |
|
| 630 | * Returns whether or not the product can be backordered. |
|
| @@ 416-431 (lines=16) @@ | ||
| 413 | * |
|
| 414 | * @return bool |
|
| 415 | */ |
|
| 416 | public function is_in_stock() { |
|
| 417 | $status = $this->stock_status === 'instock'; |
|
| 418 | ||
| 419 | /** |
|
| 420 | * Sanity check to ensure stock qty is not lower than 0 but still listed |
|
| 421 | * instock. |
|
| 422 | * |
|
| 423 | * Check is not required for products on backorder since they can be |
|
| 424 | * instock regardless of actual stock quantity. |
|
| 425 | */ |
|
| 426 | if ( true === $this->managing_stock() && ! $this->backorders_allowed() && $this->get_stock_quantity() <= get_option( 'woocommerce_notify_no_stock_amount' ) ) { |
|
| 427 | $status = false; |
|
| 428 | } |
|
| 429 | ||
| 430 | return apply_filters( 'woocommerce_variation_is_in_stock', $status ); |
|
| 431 | } |
|
| 432 | ||
| 433 | /** |
|
| 434 | * Set stock level of the product variation. |
|