| 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 echo isset( $settings['low_inventory_text'] ) |
| 19 |
? esc_html( str_replace( |
| 20 |
'{stock}', |
| 21 |
$args['stock'], |
| 22 |
$settings['low_inventory_text'] |
| 23 |
) ) |
| 24 |
: esc_html( |
| 25 |
/* Translators: 1. Quantity of units */ |
| 26 |
sprintf( __( 'Hurry! Only %s units left in stock!', 'merchant' ), $args['stock'] ) |
| 27 |
); ?> |
| 28 |
</div> |
| 29 |
<div class="merchant-stock-scarcity-content"> |
| 30 |
<div class="merchant-stock-scarcity-progress-bar" style="width: <?php echo esc_attr( $args['percentage'] ) . '%'; ?>"></div> |
| 31 |
</div> |
| 32 |
</div> |
| 33 |
|