PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 1.10.3
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v1.10.3
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.10.3, at templates/modules/stock-scarcity/single-product.php

42 lines 1.5 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 if ( ! empty( $args['is_simple'] ) ) {
20 $low_inventory_text = ! empty( $settings['low_inventory_text_simple'] ) ? Merchant_Translator::translate( $settings['low_inventory_text_simple'] ) : esc_html__( 'Hurry, low stock.', 'merchant' );
21 } elseif ( $args['stock'] > 1 ) {
22 $low_inventory_text = isset( $settings['low_inventory_text_plural'] ) ? Merchant_Translator::translate( $settings['low_inventory_text_plural'] ) : '';
23 } else {
24 $low_inventory_text = isset( $settings['low_inventory_text'] ) ? Merchant_Translator::translate( $settings['low_inventory_text'] ) : '';
25 }
26
27 echo ! empty( $low_inventory_text )
28 ? esc_html( str_replace(
29 '{stock}',
30 $args['stock'],
31 $low_inventory_text
32 ) )
33 : esc_html(
34 /* Translators: 1. Quantity of units */
35 sprintf( _n( 'Hurry! Only %s unit left in stock!', 'Hurry! Only %s units left in stock!', $args['stock'], 'merchant' ), $args['stock'] )
36 ); ?>
37 </div>
38 <div class="merchant-stock-scarcity-content">
39 <div class="merchant-stock-scarcity-progress-bar" style="width: <?php echo esc_attr( $args['percentage'] ) . '%'; ?>"></div>
40 </div>
41 </div>
42