Skip to content

Commit

Permalink
show hide discount info in check out mode
Browse files Browse the repository at this point in the history
  • Loading branch information
habibillah committed Jun 17, 2016
1 parent e4a0a01 commit af12cd4
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions classes/client-fixed-quantity-price.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<span class='discount-info'><span class='new-price'>$price <span style='color: #4AB915; font-weight: bold;'>";
$newPrice .= sprintf(__("(Incl. %s%% discount)", "woofix"), $discount) . "</span></span>";
$newPrice .= "</span>";
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;
Expand Down

0 comments on commit af12cd4

Please sign in to comment.