From eb85cd1682f58985ed3be31cd560851f7901c147 Mon Sep 17 00:00:00 2001 From: Justin Shreve Date: Mon, 29 Jun 2015 19:24:48 +0000 Subject: [PATCH] Add $price and $qty to get_price_suffix so custom values can be passed into get_price_including_tax and get_price_excluding_tax --- includes/abstracts/abstract-wc-product.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index ea52cf8de20..318c6b62818 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -897,9 +897,15 @@ class WC_Product { /** * Get the suffix to display after prices > 0 * + * @param string $price to calculate, left blank to just use get_price() + * @param integer $qty passed on to get_price_including_tax() or get_price_excluding_tax() * @return string */ - public function get_price_suffix() { + public function get_price_suffix( $price = '', $qty = 1 ) { + + if ( $price === '' ) { + $price = $this->get_price(); + } $price_display_suffix = get_option( 'woocommerce_price_display_suffix' ); @@ -913,8 +919,8 @@ class WC_Product { ); $replace = array( - wc_price( $this->get_price_including_tax() ), - wc_price( $this->get_price_excluding_tax() ) + wc_price( $this->get_price_including_tax( $qty, $price ) ), + wc_price( $this->get_price_excluding_tax( $qty, $price ) ) ); $price_display_suffix = str_replace( $find, $replace, $price_display_suffix );