| @@ 687-711 (lines=25) @@ | ||
| 684 | $availability = __( 'Available on backorder', 'woocommerce' ); |
|
| 685 | $class = 'available-on-backorder'; |
|
| 686 | ||
| 687 | } elseif ( $this->managing_stock() ) { |
|
| 688 | switch ( get_option( 'woocommerce_stock_format' ) ) { |
|
| 689 | case 'no_amount' : |
|
| 690 | $availability = __( 'In stock', 'woocommerce' ); |
|
| 691 | break; |
|
| 692 | case 'low_amount' : |
|
| 693 | if ( $this->get_total_stock() <= get_option( 'woocommerce_notify_low_stock_amount' ) ) { |
|
| 694 | $availability = sprintf( __( 'Only %s left in stock', 'woocommerce' ), $this->get_total_stock() ); |
|
| 695 | ||
| 696 | if ( $this->backorders_allowed() && $this->backorders_require_notification() ) { |
|
| 697 | $availability .= ' ' . __( '(also available on backorder)', 'woocommerce' ); |
|
| 698 | } |
|
| 699 | } else { |
|
| 700 | $availability = __( 'In stock', 'woocommerce' ); |
|
| 701 | } |
|
| 702 | break; |
|
| 703 | default : |
|
| 704 | $availability = sprintf( __( '%s in stock', 'woocommerce' ), $this->get_total_stock() ); |
|
| 705 | ||
| 706 | if ( $this->backorders_allowed() && $this->backorders_require_notification() ) { |
|
| 707 | $availability .= ' ' . __( '(also available on backorder)', 'woocommerce' ); |
|
| 708 | } |
|
| 709 | break; |
|
| 710 | } |
|
| 711 | } |
|
| 712 | ||
| 713 | return apply_filters( 'woocommerce_get_availability', array( 'availability' => $availability, 'class' => $class ), $this ); |
|
| 714 | } |
|
| @@ 560-584 (lines=25) @@ | ||
| 557 | $availability = __( 'Available on backorder', 'woocommerce' ); |
|
| 558 | $class = 'available-on-backorder'; |
|
| 559 | ||
| 560 | } elseif ( true === $this->managing_stock() ) { |
|
| 561 | switch ( get_option( 'woocommerce_stock_format' ) ) { |
|
| 562 | case 'no_amount' : |
|
| 563 | $availability = __( 'In stock', 'woocommerce' ); |
|
| 564 | break; |
|
| 565 | case 'low_amount' : |
|
| 566 | if ( $this->get_stock_quantity() <= get_option( 'woocommerce_notify_low_stock_amount' ) ) { |
|
| 567 | $availability = sprintf( __( 'Only %s left in stock', 'woocommerce' ), $this->get_stock_quantity() ); |
|
| 568 | ||
| 569 | if ( $this->backorders_allowed() && $this->backorders_require_notification() ) { |
|
| 570 | $availability .= ' ' . __( '(also available on backorder)', 'woocommerce' ); |
|
| 571 | } |
|
| 572 | } else { |
|
| 573 | $availability = __( 'In stock', 'woocommerce' ); |
|
| 574 | } |
|
| 575 | break; |
|
| 576 | default : |
|
| 577 | $availability = sprintf( __( '%s in stock', 'woocommerce' ), $this->get_stock_quantity() ); |
|
| 578 | ||
| 579 | if ( $this->backorders_allowed() && $this->backorders_require_notification() ) { |
|
| 580 | $availability .= ' ' . __( '(also available on backorder)', 'woocommerce' ); |
|
| 581 | } |
|
| 582 | break; |
|
| 583 | } |
|
| 584 | } elseif ( 'parent' === $this->managing_stock() ) { |
|
| 585 | return parent::get_availability(); |
|
| 586 | } |
|
| 587 | ||