diff --git a/classes/client-fixed-quantity-price.php b/classes/client-fixed-quantity-price.php index 5f436f0..af918e6 100644 --- a/classes/client-fixed-quantity-price.php +++ b/classes/client-fixed-quantity-price.php @@ -298,22 +298,31 @@ public function filter_subtotal_price($price, $cart_item) */ public function order_formatted_line_subtotal($price, $product) { - $productId = WoofixUtility::getActualId($product); - $fixedPriceData = WoofixUtility::isFixedQtyPrice($productId); - if ($fixedPriceData !== false) { - $discount = 0; + if (get_option(WOOFIXOPT_SHOW_DISC) === WOOFIXCONF_SHOW_DISC) { - foreach ($fixedPriceData['woofix'] as $disc) { - if ($disc['woofix_qty'] == $product['qty']) { - $discount = $disc['woofix_disc']; - } - } + $productId = WoofixUtility::getActualId($product); + $fixedPriceData = WoofixUtility::isFixedQtyPrice($productId); + if ($fixedPriceData !== false) { + + /** @noinspection PhpUnusedLocalVariableInspection */ + $discount = "0%"; - $newPrice = "$price "; - $newPrice .= sprintf(__("(Incl. %s%% discount)", "woofix"), $discount) . ""; - $newPrice .= ""; + foreach ($fixedPriceData['woofix'] as $disc) { + if ($disc['woofix_qty'] == $product['qty']) { - return $newPrice; + /** @noinspection PhpUnusedLocalVariableInspection */ + $discount = $disc['woofix_disc'] . "%"; + } + } + + $template = $this->woofix_locate_template( 'discount-info.php' ); + if ( $template !== false ) { + ob_start(); + /** @noinspection PhpIncludeInspection */ + include($template); + $price = ob_get_clean(); + } + } } return $price;