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 / stock-scarcity / 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/stock-scarcity/single-product.php

40 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template for stock scarcity module content on single product.
4 *
5 * @var $args array template args
6 *
7 * @since 1.0
8 */
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly
12 }
13
14 $settings = isset( $args['settings'] ) ? $args['settings'] : array();
15 ?>
16 <div class="merchant-stock-scarcity">
17 <div class="merchant-stock-scarcity-message">
18 <?php
19 $low_inventory_text = isset( $settings['low_inventory_text'] ) ? Merchant_Translator::translate( $settings['low_inventory_text'] ) : '';
20
21 if ( $args['stock'] > 1 ) {
22 $low_inventory_text = isset( $settings['low_inventory_text_plural'] ) ? Merchant_Translator::translate( $settings['low_inventory_text_plural'] ) : '';
23 }
24
25 echo ! empty( $low_inventory_text )
26 ? esc_html( str_replace(
27 '{stock}',
28 $args['stock'],
29 $low_inventory_text
30 ) )
31 : esc_html(
32 /* Translators: 1. Quantity of units */
33 sprintf( _n( 'Hurry! Only %s unit left in stock!', 'Hurry! Only %s units left in stock!', $args['stock'], 'merchant' ), $args['stock'] )
34 ); ?>
35 </div>
36 <div class="merchant-stock-scarcity-content">
37 <div class="merchant-stock-scarcity-progress-bar" style="width: <?php echo esc_attr( $args['percentage'] ) . '%'; ?>"></div>
38 </div>
39 </div>
40