Code Duplication    Length = 16-16 lines in 2 locations

includes/abstracts/abstract-wc-product.php 1 location

@@ 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.

includes/class-wc-product-variation.php 1 location

@@ 417-432 (lines=16) @@
414
	 *
415
	 * @return bool
416
	 */
417
	public function is_in_stock() {
418
		$status = $this->stock_status === 'instock';
419
420
		/**
421
		 * Sanity check to ensure stock qty is not lower than 0 but still listed
422
		 * instock.
423
		 *
424
		 * Check is not required for products on backorder since they can be
425
		 * instock regardless of actual stock quantity.
426
		 */
427
		if ( true === $this->managing_stock() && ! $this->backorders_allowed() && $this->get_stock_quantity() <= get_option( 'woocommerce_notify_no_stock_amount' ) ) {
428
			$status = false;
429
		}
430
431
		return apply_filters( 'woocommerce_variation_is_in_stock', $status );
432
	}
433
434
	/**
435
	 * Set stock level of the product variation.