Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 610-625 (lines=16) @@
607
	 *
608
	 * @return bool
609
	 */
610
	public function is_in_stock() {
611
		$status = $this->stock_status === 'instock';
612
613
		/**
614
		 * Sanity check to ensure stock qty is not lower than 0 but still listed
615
		 * instock.
616
		 *
617
		 * Check is not required for products on backorder since they can be
618
		 * instock regardless of actual stock quantity.
619
		 */
620
		if ( $this->managing_stock() && ! $this->backorders_allowed() && $this->get_total_stock() <= get_option( 'woocommerce_notify_no_stock_amount' ) ) {
621
			$status = false;
622
		}
623
624
		return apply_filters( 'woocommerce_product_is_in_stock', $status );
625
	}
626
627
	/**
628
	 * Returns whether or not the product can be backordered.

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

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