Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sarancartrabbit/7b9f5aa56f25717286b334d7cefe36e8 to your computer and use it in GitHub Desktop.
Save sarancartrabbit/7b9f5aa56f25717286b334d7cefe36e8 to your computer and use it in GitHub Desktop.
Discount rules v2: Get product price Excluding tax
<?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