Created
March 13, 2020 00:48
-
-
Save bstonedev/6455ef10eecf782ae07a0f555871aec4 to your computer and use it in GitHub Desktop.
Find discount amount for WooCommerce Product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$product = wc_get_product($product_id); | |
if( $product->is_on_sale() ) { | |
$discount = $product->get_regular_price() - $product->get_sale_price(); | |
} | |
else { | |
$discount = 0; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment