PluginProbe
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce / 2.2.8
HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce v2.2.8
2.15.0 trunk 1.0.0 1.0.1 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 All 62 releases
hurrytimer / includes / functions.php

functions.php in HurryTimer – An Scarcity and Urgency Countdown Timer for WordPress & WooCommerce 2.2.8, at includes/functions.php

52 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!function_exists('hurryt_wc_stock_statuses')) {
4 function hurryt_wc_stock_statuses()
5 {
6 return [
7 [
8 'name' => __('In stock', 'hurrytimer'),
9 'id' => \Hurrytimer\C::WC_IN_STOCK,
10 ],
11 [
12 'name' => __('Out of stock', 'hurrytimer'),
13 'id' => \Hurrytimer\C::WC_OUT_OF_STOCK,
14 ],
15 [
16 'name' => __('On backorder', 'hurrytimer'),
17 'id' => \Hurrytimer\C::WC_ON_BACKORDER,
18 ],
19 ];
20 }
21 }
22
23 if (!function_exists('hurryt_wc_conditions')) {
24 function hurryt_wc_conditions()
25 {
26 return (new \Hurrytimer\ConditionalLogic())->addRule([
27 'key' => 'stock_status',
28 'name' => __('Stock status', 'hurrytimer'),
29 'operators' => ['==', '!='],
30 'values' => hurryt_wc_stock_statuses(),
31 'type' => 'string',
32 ])->addRule([
33 'key' => 'stock_quantity',
34 'name' => __('Stock quantity', 'hurrytimer'),
35 'operators' => ['==', '!=', '<', '>'],
36 'values' => [],
37 'type' => 'number',
38 ])->addRule([
39 'key' => 'shipping_class',
40 'name' => __('Shipping class', 'hurrytimer'),
41 'operators' => ['==', '!='],
42 'values' => array_map(function ($class) {
43 return [
44 'name' => $class->name,
45 'id' => $class->term_id,
46 ];
47 }, \WC_Shipping::instance()->get_shipping_classes()),
48 ])->get();
49 }
50 }
51
52