Last active
January 5, 2024 10:54
-
-
Save sarancartrabbit/7b9f5aa56f25717286b334d7cefe36e8 to your computer and use it in GitHub Desktop.
Discount rules v2: Get product price Excluding tax
This file contains 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 | |
global $product; // or use wc_get_product() function for get product object | |
$sale_price = $product->get_price(); | |
$discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $sale_price, $product, 1, 0, 'discounted_price', true, false); | |
if($discount !== false) { | |
$sale_price = $discount; | |
} | |
$product_price_excluding_tax = wc_get_price_excluding_tax( $product ,array('price' => $sale_price)); // get product price with excluding tax | |
$product_price_including_tax = wc_get_price_including_tax( $product ,array('price' => $sale_price)); // get product price with including tax | |
// echo $product_price_excluding_tax; | |
// echo $product_price_including_tax; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment