$discount_tier ) :
if ( isset( $discount_tier['discount_type'], $discount_tier['product_single_page']['save_label'], $discount_tier['product_single_page']['item_text'], $discount_tier['product_single_page']['total_text'] ) ) {
$discount = $discount_tier['discount_type'] === 'percentage_discount'
? ( $args['product_price'] * $discount_tier['discount'] ) / 100
: $discount_tier['discount'];
$discount_percent = ( $discount_tier['discount'] ?? 0 ) . '%';
$discount_qty = (int) ( $discount_tier['quantity'] ?? 1 );
$discounted_price = $args['product_price'] - $discount;
$total_discount = $discount_qty * $discount;
$total_price = $discount_qty * $discounted_price;
$clickable = '';
$product_type = '';
if ( ! $product->is_type( 'variable' ) && $quantity < $discount_qty ) {
$clickable = ' clickable';
}
if ( isset( $discount_tier['product_single_page']['table_title'] ) && ! empty( $discount_tier['product_single_page']['table_title'] ) ) : ?>
is_type( 'variable' );
// Get available variations and attributes
$available_variations = $is_variable ? $product->get_available_variations() : array();
$attributes = $is_variable ? $product->get_variation_attributes() : array();
$available_variations = $is_variable ? $product->get_available_variations() : array();
if ( isset( $discount_tier['product_single_page']['table_item_text_color'] ) ) {
// todo: to be improved later
?>
' . esc_html( $discount_qty ) . '',
'' . esc_html( $discount_qty ) . '',
'' . wc_price( $discount ) . '',
'' . esc_html( $discount_percent ) . '',
),
esc_html( Merchant_Translator::translate( $discount_tier['product_single_page']['buy_text'] ) )
),
merchant_kses_allowed_tags( array( 'bdi' ) )
);
} else {
echo wp_kses(
str_replace(
array(
'{quantity}',
'{discount}',
),
array(
'' . esc_html( $discount_qty ) . '',
'' . wc_price( $discount ) . '',
),
esc_html__( 'Buy {quantity}, get {discount} off each', 'merchant' )
),
merchant_kses_allowed_tags( array( 'bdi' ) )
);
}
?>