PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.8
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.8
2.3.2 2.3.1 2.3.0 2.2.8 2.2.7 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.11.0 1.11.1 1.11.2 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 1.9.10 1.9.11 All 60 releases
merchant / templates / modules / volume-discounts / single-product.php

single-product.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 1.8, at templates/modules/volume-discounts/single-product.php

75 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Template for Volume Discounts Single Product
5 *
6 * @var array $args template args
7 *
8 * @since 1.4
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly
13 }
14
15 ?>
16
17 <div class="merchant-volume-discounts">
18 <div class="merchant-volume-discounts-title"><?php echo esc_html( Merchant_Translator::translate( $args['settings']['table_title'] ) ) ?></div>
19 <?php foreach ( $args['discount_tiers'] as $discount_tier ) :
20 $discount = $discount_tier['layout'] === 'percentage_discount'
21 ? ( $args['product_price'] * $discount_tier['discount'] ) / 100
22 : $discount_tier['discount'];
23
24 $discounted_price = $args['product_price'] - $discount;
25 $total_discount = intval( $discount_tier['quantity'] ) * $discount;
26 $total_price = intval( $discount_tier['quantity'] ) * $discounted_price; ?>
27 <div class="merchant-volume-discounts-item">
28 <div class="merchant-volume-discounts-buy-label">
29 <?php echo wp_kses(
30 str_replace(
31 array(
32 '{amount}',
33 '{discount}'
34 ),
35 array(
36 '<strong>' . esc_attr( $discount_tier['quantity'] ) . '</strong>',
37 '<strong>' . wc_price( $discount ) . '</strong>'
38 ),
39 esc_html( Merchant_Translator::translate( $args['settings']['buy_text'] ) )
40 ),
41 merchant_kses_allowed_tags( array( 'bdi' ) )
42 );
43 ?>
44 </div>
45 <ul>
46 <li>
47 <div></div>
48 <div>
49 <del><?php echo wp_kses( wc_price( $args['product_price'] ), merchant_kses_allowed_tags( array( 'bdi' ) ) ); ?></del>
50 </div>
51 </li>
52 <li>
53 <div class="merchant-volume-discounts-item-text"><?php echo esc_html( Merchant_Translator::translate( $args['settings']['item_text'] ) ) ?></div>
54 <div><strong><?php echo wp_kses( wc_price( $discounted_price ), merchant_kses_allowed_tags( array( 'bdi' ) ) ); ?></strong></div>
55 </li>
56 <li>
57 <div class="merchant-volume-discounts-total-text"><?php echo esc_html( Merchant_Translator::translate( $args['settings']['total_text'] ) ) ?></div>
58 <div><strong><?php echo wp_kses( wc_price( $total_price ), merchant_kses_allowed_tags( array( 'bdi' ) ) ); ?></strong></div>
59 </li>
60 </ul>
61 <div class="merchant-volume-discounts-item-label">
62 <span class="merchant-volume-discounts-save-label">
63 <?php echo wp_kses(
64 str_replace(
65 '{amount}',
66 wc_price( $total_discount ),
67 esc_html( Merchant_Translator::translate( $args['settings']['save_label'] ) )
68 ),
69 merchant_kses_allowed_tags( array( 'bdi' ) )
70 ); ?>
71 </span>
72 </div>
73 </div>
74 <?php endforeach; ?>
75 </div>