woocommerce_product_is_on_sale

woocommerce_product_is_on_sale

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_product_is_on_sale') is found 3 times:

  • /includes/abstracts/abstract-wc-product.php line 1696
    1692
    1693
    1694
    1695
    1696
    1697
    1698
    1699
    1700
    1701
    1702
            }
        } else {
            $on_sale = false;
        }
        return 'view' === $context ? apply_filters( 'woocommerce_product_is_on_sale', $on_sale, $this ) : $on_sale;
    }
     
    /**
     * Returns whether or not the product has dimensions set.
     *
     * @return bool
  • /includes/class-wc-product-grouped.php line 75
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
                break;
            }
        }
     
        return 'view' === $context ? apply_filters( 'woocommerce_product_is_on_sale', $on_sale, $this ) : $on_sale;
    }
     
    /**
     * Returns false if the product cannot be bought.
     *
     * @return bool
  • /includes/class-wc-product-variable.php line 514
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    public function is_on_sale( $context = 'view' ) {
        $prices  = $this->get_variation_prices();
        $on_sale = $prices['regular_price'] !== $prices['sale_price'] && $prices['sale_price'] === $prices['price'];
     
        return 'view' === $context ? apply_filters( 'woocommerce_product_is_on_sale', $on_sale, $this ) : $on_sale;
    }
     
    /**
     * Is a child in stock?
     *
     * @return boolean