PluginProbe
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant / 2.2.7
Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant v2.2.7
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 / inc / modules / spending-goal / admin / options.php

options.php in Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce – Merchant 2.2.7, at inc/modules/spending-goal/admin/options.php

355 lines 9.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Spending Goal Options.
5 *
6 * @package Merchant
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly
11 }
12
13 // Settings
14 Merchant_Admin_Options::create( array(
15 'title' => esc_html__( 'Settings', 'merchant' ),
16 'module' => Merchant_Spending_Goal::MODULE_ID,
17 'fields' => array(
18
19 array(
20 'id' => 'spending_goal',
21 'type' => 'number',
22 'title' => esc_html__( 'Spending goal', 'merchant' ),
23 'step' => 0.01,
24 'default' => 150,
25 ),
26
27 array(
28 'id' => 'total_type',
29 'type' => 'select',
30 'title' => esc_html__( 'Based on', 'merchant' ),
31 'desc' => esc_html__( 'Choose the basis for the spending goal. “Cart Subtotal” excludes additional calculated discounts, whereas “Cart Total” includes them.', 'merchant' ),
32 'options' => array(
33 'subtotal' => esc_html__( 'Cart subtotal', 'merchant' ),
34 'total' => esc_html__( 'Cart total', 'merchant' ),
35 ),
36 'default' => 'subtotal',
37 ),
38
39 array(
40 'id' => 'discount_type',
41 'type' => 'select',
42 'title' => esc_html__( 'Discount type', 'merchant' ),
43 'options' => array(
44 'percent' => esc_html__( 'Percent', 'merchant' ),
45 'fixed' => esc_html__( 'Fixed amount', 'merchant' ),
46 ),
47 'default' => 'percent',
48 ),
49
50 array(
51 'id' => 'discount_amount',
52 'type' => 'number',
53 'title' => esc_html__( 'Discount amount', 'merchant' ),
54 'step' => 0.01,
55 'default' => 10,
56 ),
57
58 array(
59 'id' => 'discount_name',
60 'type' => 'text',
61 'title' => esc_html__( 'Discount name', 'merchant' ),
62 'default' => esc_html__( 'Spending goal', 'merchant' ),
63 'desc' => esc_html__( 'This will be the name of the applied discount on the cart page.', 'merchant' ),
64 ),
65
66 array(
67 'id' => 'inclusion',
68 'type' => 'switcher',
69 'title' => esc_html__( 'Product Inclusion', 'merchant' ),
70 'desc' => esc_html__( 'Include only certain products or categories', 'merchant' ),
71 'default' => 0,
72 ),
73
74 array(
75 'id' => 'included_products',
76 'type' => 'products_selector',
77 'title' => esc_html__( 'Include Products', 'merchant' ),
78 'multiple' => true,
79 'conditions' => array(
80 'relation' => 'AND',
81 'terms' => array(
82 array(
83 'field' => 'inclusion',
84 'operator' => '===',
85 'value' => true,
86 ),
87 ),
88 ),
89 ),
90
91 array(
92 'id' => 'included_categories',
93 'type' => 'select_ajax',
94 'title' => esc_html__( 'Include Categories', 'merchant' ),
95 'source' => 'options',
96 'multiple' => true,
97 'options' => Merchant_Admin_Options::get_category_select2_choices(),
98 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
99 'conditions' => array(
100 'relation' => 'AND',
101 'terms' => array(
102 array(
103 'field' => 'inclusion',
104 'operator' => '===',
105 'value' => true,
106 ),
107 ),
108 ),
109 ),
110
111 array(
112 'id' => 'exclusion',
113 'type' => 'switcher',
114 'title' => esc_html__( 'Product Exclusion', 'merchant' ),
115 'desc' => esc_html__( 'Exclude certain products or categories', 'merchant' ),
116 'default' => 0,
117 ),
118
119 array(
120 'id' => 'excluded_products',
121 'type' => 'products_selector',
122 'title' => esc_html__( 'Exclude Products', 'merchant' ),
123 'multiple' => true,
124 'conditions' => array(
125 'relation' => 'AND',
126 'terms' => array(
127 array(
128 'field' => 'exclusion',
129 'operator' => '===',
130 'value' => true,
131 ),
132 ),
133 ),
134 ),
135
136 array(
137 'id' => 'excluded_categories',
138 'type' => 'select_ajax',
139 'title' => esc_html__( 'Exclude Categories', 'merchant' ),
140 'source' => 'options',
141 'multiple' => true,
142 'options' => Merchant_Admin_Options::get_category_select2_choices(),
143 'placeholder' => esc_html__( 'Select categories', 'merchant' ),
144 'conditions' => array(
145 'relation' => 'AND',
146 'terms' => array(
147 array(
148 'field' => 'exclusion',
149 'operator' => '===',
150 'value' => true,
151 ),
152 ),
153 ),
154 ),
155
156 array(
157 'id' => 'user_condition',
158 'type' => 'select',
159 'title' => esc_html__( 'User Condition', 'merchant' ),
160 'options' => array(
161 'all' => esc_html__( 'All Users', 'merchant' ),
162 'customers' => esc_html__( 'Selected Users', 'merchant' ),
163 'roles' => esc_html__( 'Selected Roles', 'merchant' ),
164 ),
165 'default' => 'all',
166 ),
167
168 array(
169 'id' => 'user_condition_roles',
170 'type' => 'select_ajax',
171 'title' => esc_html__( 'User Roles', 'merchant' ),
172 'desc' => esc_html__( 'This will limit the offer to users with these roles.', 'merchant' ),
173 'source' => 'options',
174 'multiple' => true,
175 'classes' => array( 'flex-grow' ),
176 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
177 'condition' => array( 'user_condition', '==', 'roles' ),
178 ),
179
180 array(
181 'id' => 'user_condition_users',
182 'type' => 'select_ajax',
183 'title' => esc_html__( 'Users', 'merchant' ),
184 'desc' => esc_html__( 'This will limit the offer to the selected customers.', 'merchant' ),
185 'source' => 'user',
186 'multiple' => true,
187 'classes' => array( 'flex-grow' ),
188 'condition' => array( 'user_condition', '==', 'customers' ),
189 ),
190
191 array(
192 'id' => 'user_exclusion_enabled',
193 'type' => 'switcher',
194 'title' => esc_html__( 'Exclusion List', 'merchant' ),
195 'desc' => esc_html__( 'Choose the users who will not see this offer.', 'merchant' ),
196 'default' => 0,
197 'conditions' => array(
198 'relation' => 'AND',
199 'terms' => array(
200 array(
201 'field' => 'user_condition',
202 'operator' => 'in',
203 'value' => array( 'all', 'roles' ),
204 ),
205 ),
206 ),
207 ),
208
209 array(
210 'id' => 'exclude_users',
211 'type' => 'select_ajax',
212 'title' => esc_html__( 'Exclude Users', 'merchant' ),
213 'desc' => esc_html__( 'This will exclude the offer for the selected customers.', 'merchant' ),
214 'source' => 'user',
215 'multiple' => true,
216 'classes' => array( 'flex-grow' ),
217 'conditions' => array(
218 'relation' => 'AND',
219 'terms' => array(
220 array(
221 'field' => 'user_condition',
222 'operator' => 'in',
223 'value' => array( 'all', 'roles' ),
224 ),
225 array(
226 'field' => 'user_exclusion_enabled',
227 'operator' => '===',
228 'value' => true,
229 ),
230 ),
231 ),
232 ),
233
234 array(
235 'id' => 'exclude_roles',
236 'type' => 'select_ajax',
237 'title' => esc_html__( 'Exclude Roles', 'merchant' ),
238 'desc' => esc_html__( 'This will exclude the offer for users with these roles.', 'merchant' ),
239 'source' => 'options',
240 'multiple' => true,
241 'classes' => array( 'flex-grow' ),
242 'options' => Merchant_Admin_Options::get_user_roles_select2_choices(),
243 'conditions' => array(
244 'relation' => 'AND',
245 'terms' => array(
246 array(
247 'field' => 'user_condition',
248 'operator' => 'in',
249 'value' => array( 'all' ),
250 ),
251 array(
252 'field' => 'user_exclusion_enabled',
253 'operator' => '===',
254 'value' => true,
255 ),
256 ),
257 ),
258 ),
259
260 array(
261 'id' => 'enable_auto_slide_in',
262 'type' => 'switcher',
263 'title' => esc_html__( 'Enable Auto Slide In', 'merchant' ),
264 'desc' => esc_html__( 'This will make the widget slide in each time a product is added to the cart.', 'merchant' ),
265 'default' => 1,
266 ),
267 ),
268 ) );
269
270 // Text Formatting Settings
271 Merchant_Admin_Options::create( array(
272 'title' => esc_html__( 'Text Formatting Settings', 'merchant' ),
273 'module' => Merchant_Spending_Goal::MODULE_ID,
274 'fields' => array(
275
276 array(
277 'id' => 'text_goal_zero',
278 'type' => 'text',
279 'title' => esc_html__( 'When the goal target is at 0%', 'merchant' ),
280 'default' => esc_html__( 'Spend {spending_goal} to get a {discount_amount} discount!', 'merchant' ),
281 'desc' => esc_html__( 'Default is: Spend {spending_goal} to get a {discount_amount} discount!', 'merchant' ),
282 ),
283
284 array(
285 'id' => 'text_goal_started',
286 'type' => 'text',
287 'title' => esc_html__( 'When the goal target is between 1-99%', 'merchant' ),
288 'default' => esc_html__( 'Spend {spending_goal} more to get a {discount_amount} discount!', 'merchant' ),
289 'desc' => esc_html__( 'Default is: Spend {spending_goal} more to get a {discount_amount} discount!', 'merchant' ),
290 ),
291
292 array(
293 'id' => 'text_goal_reached',
294 'type' => 'text',
295 'title' => esc_html__( 'When the goal target is at 100%', 'merchant' ),
296 'default' => esc_html__( 'Congratulations! You got a discount of {discount_amount} on this order!', 'merchant' ),
297 'desc' => esc_html__( 'Default: Congratulations! You got a discount of {discount_amount} on this order!', 'merchant' ),
298 ),
299 ),
300 ) );
301
302 // Style Settings
303 Merchant_Admin_Options::create( array(
304 'module' => Merchant_Spending_Goal::MODULE_ID,
305 'title' => esc_html__( 'Style', 'merchant' ),
306 'fields' => array(
307
308 array(
309 'id' => 'gradient_start',
310 'type' => 'color',
311 'title' => esc_html__( 'Gradient start', 'merchant' ),
312 'default' => '#5e5e5e',
313 ),
314
315 array(
316 'id' => 'gradient_end',
317 'type' => 'color',
318 'title' => esc_html__( 'Gradient end', 'merchant' ),
319 'default' => '#212121',
320 ),
321
322 array(
323 'id' => 'progress_bar',
324 'type' => 'color',
325 'title' => esc_html__( 'Progress bar color', 'merchant' ),
326 'default' => '#d83a3b',
327 ),
328
329 array(
330 'id' => 'content_width',
331 'type' => 'range',
332 'title' => esc_html__( 'Content width', 'merchant' ),
333 'min' => 0,
334 'max' => 600,
335 'step' => 1,
336 'unit' => 'px',
337 'default' => 300,
338 ),
339
340 array(
341 'id' => 'content_bg_color',
342 'type' => 'color',
343 'title' => esc_html__( 'Content background color', 'merchant' ),
344 'default' => '#f9f9f9',
345 ),
346
347 array(
348 'id' => 'content_text_color',
349 'type' => 'color',
350 'title' => esc_html__( 'Content text color', 'merchant' ),
351 'default' => '#3c434a',
352 ),
353 ),
354 ) );
355