get_sale_price();
if ( $sale_price ) {
$sale_price = wc_get_price_to_display( $product, array(
'price' => $sale_price,
) );
}
$regular_price = wc_get_price_to_display( $product, array(
'price' => $product->get_regular_price(),
) );
$price = wc_get_price_to_display( $product, array(
'price' => $product->get_price(),
) );
if ( ! function_exists( 'tptParsePlainText' ) ) {
function tptParsePlainText( $text, $quantity, $discount = null, $price = null, $base_unit_name = null ) {
return strtr( $text, array(
'{tp_quantity}' => $quantity,
'{tp_discount}' => ! is_null( $discount ) ? round( (float) $discount, \TierPricingTable\PricingTable::discountDecimals( (float) $discount ) ) : $discount,
'{tp_rounded_discount}' => ! is_null( $discount ) ? round( $discount ) : 0,
'{tp_price}' => $price ? wc_price( $price ) : '',
'{tp_base_unit_name}' => $base_unit_name,
) );
}
}
?>
-
is_on_sale() ) {
$discountAmount = PriceManager::calculateDiscount( $product->get_regular_price(),
$product->get_sale_price() );
}
?>
= array_keys( $price_rules )[0] - $minimum || 'static' === $settings['quantity_type'] ) : ?>
1 ? $settings['quantity_measurement_plural'] : $settings['quantity_measurement_singular'];
?>
0 ) : ?>
$id,
'style' => 'default',
) );
?>
valid() ) : ob_start(); ?>
current();
$currentQuantity = $iterator->key();
if ( 'percentage' === $pricing_type ) {
$discountAmount = $currentPrice;
} else {
$discountAmount = PriceManager::calculateDiscount( CalculationLogic::calculateDiscountBasedOnRegularPrice() ? $product->get_regular_price() : $product->get_price(),
$pricing_rule->getTierPrice( $currentQuantity, false ) );
}
$iterator->next();
if ( $iterator->valid() ) {
$quantity = number_format_i18n( $currentQuantity );
if ( (int) $iterator->key() - 1 !== (int) $currentQuantity && 'range' === $settings['quantity_type'] ) {
$quantity .= ' - ' . number_format_i18n( intval( $iterator->key() - 1 ) );
}
} else {
$quantity = number_format_i18n( $currentQuantity );
$quantity .= apply_filters( 'tiered_pricing_table/tiered_pricing/last_tier_postfix', '+',
$currentQuantity, $pricing_rule, 'blocks' );
}
$currentProductPrice = PriceManager::getPriceByRules( $currentQuantity, $product_id );
$currentProductPriceExcludeTaxes = wc_get_price_excluding_tax( wc_get_product( $product_id ), array(
'price' => PriceManager::getPriceByRules( $currentQuantity, $product_id, null, null, false ),
) );
$currentProductPriceIncludeTaxes = wc_get_price_including_tax( wc_get_product( $product_id ), array(
'price' => PriceManager::getPriceByRules( $currentQuantity, $product_id, null, null, false ),
) );
?>
-
$id,
'style' => 'default',
) );
?>