PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Models / GeneralList.php

GeneralList.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.6, at app/Models/GeneralList.php

1,742 lines 59.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace RadiusTheme\SB\Models;
4
5 use RadiusTheme\SB\AI\AIFns;
6 use RadiusTheme\SB\Helpers\Fns;
7 use RadiusTheme\SB\Models\Base\ListModel;
8 use RadiusTheme\SB\Traits\SingletonTrait;
9
10 defined( 'ABSPATH' ) || exit;
11
12 /**
13 * General Settings.
14 */
15 class GeneralList extends ListModel {
16 /**
17 * Singleton
18 */
19 use SingletonTrait;
20
21 /**
22 * List Id
23 *
24 * @var string
25 */
26 protected $list_id = 'general';
27
28 /**
29 * Constructor
30 */
31 public function __construct() {
32 parent::__construct();
33 $this->title = esc_html__( 'Global Settings', 'shopbuilder' );
34 $this->description = esc_html__( 'ShopBuilder global settings for various elements.', 'shopbuilder' );
35 $this->categories = [
36 'general' => [
37 'title' => esc_html__( 'General', 'shopbuilder' ),
38 ],
39
40 'checkout' => [
41 'title' => esc_html__( 'Checkout Page', 'shopbuilder' ),
42 ],
43
44 ];
45 }
46
47 /**
48 * Package
49 *
50 * @return array
51 */
52 protected function raw_list() {
53 $list = [
54 'optimization' => apply_filters(
55 'rtsb/settings/optimization/options',
56 [
57 'id' => 'optimization',
58 'category' => 'general',
59 'title' => esc_html__( 'Advanced Optimizations', 'shopbuilder' ),
60 'package' => $this->pro_version_checker(),
61 'badge' => 'new',
62 'active_field' => [
63 'disable' => true,
64 ],
65 'fields' => [
66 'optimization_intro' => [
67 'id' => 'optimization_intro',
68 'type' => 'description',
69 'text' => __( 'Optimize your website for maximum performance from these advanced options. <br /> <span style="color: #dc3545; display: block; margin-top: 10px;">⚠️ Note: After enabling or disabling any of these settings, clear the ShopBuilder cache to ensure changes are applied correctly.</span>', 'shopbuilder' ),
70 ],
71 'enable_optimization' => [
72 'id' => 'enable',
73 'type' => 'switch',
74 'value' => 'on',
75 'label' => esc_html__( 'Enable Asset Optimization?', 'shopbuilder' ),
76 'help' => esc_html__( 'Enable this option to dynamically load assets (styles, scripts) only when needed, helping to optimize your website\'s performance', 'shopbuilder' ),
77 ],
78 'load_elementor_scripts' => [
79 'id' => 'enable',
80 'type' => 'switch',
81 'label' => esc_html__( 'Load Elementor Assets?', 'shopbuilder' ),
82 'help' => __( 'Enable this option to load necessary Elementor assets on your website. <br /> <span style="color: #dc3545;">Turn this off if you are not using Elementor widgets to optimize site performance.</span>', 'shopbuilder' ),
83 'value' => 'on',
84 'dependency' => [
85 'rules' => [
86 [
87 'item' => 'general.optimization.enable_optimization',
88 'value' => 'on',
89 'operator' => '==',
90 ],
91 ],
92 ],
93 ],
94 'context_asset_loading' => [
95 'id' => 'enable',
96 'type' => 'switch',
97 'label' => esc_html__( 'Context-Aware Asset Loading?', 'shopbuilder' ),
98 'help' => esc_html__( 'Enable this option to dynamically Load only the necessary CSS and JS for each page type (e.g., product, cart, checkout). Disabling this option will include all assets globally on every page.', 'shopbuilder' ),
99 'dependency' => [
100 'rules' => [
101 [
102 'item' => 'general.optimization.enable_optimization',
103 'value' => 'on',
104 'operator' => '==',
105 ],
106 ],
107 ],
108 ],
109 'wp_rocket_compatibility' => [
110 'id' => 'wp_rocket_compatibility',
111 'type' => 'switch',
112 'label' => esc_html__( 'WP Rocket Compatibility', 'shopbuilder' ),
113 'help' => esc_html__( 'Enable this option to ensure compatibility with the WP Rocket plugin for optimized asset loading.', 'shopbuilder' ),
114 ],
115
116 'remove_pre_loader' => [
117 'id' => 'remove_pre_loader',
118 'type' => 'switch',
119 'label' => esc_html__( 'Disable Element Preloader', 'shopbuilder' ),
120 'help' => esc_html__( 'Enable this option to remove the element preloader.', 'shopbuilder' ),
121 ],
122 /**
123 'load_gutenberg_scripts' => [
124 'id' => 'enable',
125 'type' => 'switch',
126 'label' => esc_html__( 'Load Gutenberg Scripts?', 'shopbuilder' ),
127 'help' => esc_html__( 'Switch on to load elementor scripts by dynamically loading scripts', 'shopbuilder' ),
128 ],
129 */
130 ],
131 ],
132 ),
133 'ai_implementation' => apply_filters(
134 'rtsb/settings/ai_implementation/options',
135 [
136 'id' => 'ai_implementation',
137 'category' => 'general',
138 'title' => esc_html__( 'AI-implementation', 'shopbuilder' ),
139 'package' => 'free',
140 'badge' => 'beta',
141 'active_field' => [
142 'disable' => true,
143 ],
144 'fields' => [
145 'data_ai_feature_beta_message' => [
146 'id' => 'data_ai_feature_beta_message',
147 'type' => 'description',
148 'text' => esc_html__( '🧠 AI feature is in beta — stable and fully functional, with more enhancements coming soon.', 'shopbuilder' ),
149 ],
150 'ai_tools' => [
151 'id' => 'ai_tools',
152 'label' => esc_html__( 'AI Tools', 'shopbuilder' ),
153 'type' => 'select',
154 'value' => '',
155 'options' => [
156 '' => esc_html__( '----', 'shopbuilder' ),
157 'OpenAI' => esc_html__( 'ChatGPT', 'shopbuilder' ),
158 'Gemini' => esc_html__( 'Google Gemini', 'shopbuilder' ),
159 // phpcs:ignore Generic.Commenting
160 // DeepSeek' => esc_html__( 'DeepSeek', 'shopbuilder' ), .
161 ],
162 ],
163 // GPT.
164 'gpt_models' => [
165 'id' => 'gpt_models',
166 'label' => esc_html__( 'GPT Model', 'shopbuilder' ),
167 'type' => 'select',
168 'value' => 'gpt-4o',
169 'options' => [
170 'gpt-4o' => esc_html__( 'GPT-4o (Full Version)', 'shopbuilder' ),
171 'gpt-4o-mini' => esc_html__( 'GPT-4o Mini (Light Version)', 'shopbuilder' ),
172 ],
173 'dependency' => [
174 'rules' => [
175 [
176 'item' => 'general.ai_implementation.ai_tools',
177 'value' => 'OpenAI',
178 'operator' => '==',
179 ],
180 ],
181 ],
182 ],
183 'gpt_api_key' => [
184 'id' => 'gpt_api_key',
185 'label' => esc_html__( 'ChatGPT API Key', 'shopbuilder' ),
186 'type' => 'password',
187 'placeholder' => esc_html__( 'sk-p********', 'shopbuilder' ),
188 'help' => wp_kses(
189 __(
190 'To integrate with ChatGPT, you need to obtain an API key from OpenAI. Visit <a href="https://platform.openai.com/account/api-keys" target="_blank">OpenAI API Keys</a> to generate one.',
191 'shopbuilder'
192 ),
193 [
194 'a' => [
195 'href' => [],
196 'target' => [],
197 ],
198 ]
199 ),
200 'dependency' => [
201 'rules' => [
202 [
203 'item' => 'general.ai_implementation.ai_tools',
204 'value' => 'OpenAI',
205 'operator' => '==',
206 ],
207 ],
208 ],
209 ],
210 'gpt_max_token' => [
211 'id' => 'gpt_max_token',
212 'label' => esc_html__( 'ChatGPT Maximum Characters in Prompt Input', 'shopbuilder' ),
213 'type' => 'number',
214 'help' => esc_html__(
215 'Set the maximum character limit for the prompt input. This controls how many characters users can enter, ensuring input stays concise and manageable. Higher limits may affect performance and response quality.',
216 'shopbuilder'
217 ),
218 'value' => 200,
219 'placeholder' => esc_html__( '200', 'shopbuilder' ),
220 'dependency' => [
221 'rules' => [
222 [
223 'item' => 'general.ai_implementation.ai_tools',
224 'value' => 'OpenAI',
225 'operator' => '==',
226 ],
227 ],
228 ],
229 ],
230 // Gemini.
231 'gemini_api_key' => [
232 'id' => 'gemini_api_key',
233 'label' => esc_html__( 'Gemini API Key', 'shopbuilder' ),
234 'type' => 'password',
235 'placeholder' => esc_html__( 'AIzaSy***********************', 'shopbuilder' ),
236 'help' => wp_kses(
237 __(
238 'To integrate with Google Gemini, you need to obtain an API key from Google Cloud. Visit <a href="https://makersuite.google.com/app/apikey" target="_blank">Google AI Studio API Keys</a> to generate one.',
239 'shopbuilder'
240 ),
241 [
242 'a' => [
243 'href' => [],
244 'target' => [],
245 ],
246 ]
247 ),
248 'dependency' => [
249 'rules' => [
250 [
251 'item' => 'general.ai_implementation.ai_tools',
252 'value' => 'Gemini',
253 'operator' => '==',
254 ],
255 ],
256 ],
257 ],
258 /**
259 * User Will Not Understand how Its Works.
260 'gemini_models' => [
261 'id' => 'gemini_models',
262 'label' => esc_html__( 'Gemini Model', 'shopbuilder' ),
263 'type' => 'select',
264 'value' => 'gemini-2.5-flash',
265 'options' => [
266 'gemini-2.5-flash' => esc_html__( 'Gemini 2.5 Flash', 'shopbuilder' ),
267 'gemini-2.5-pro' => esc_html__( 'Gemini 2.5 Pro', 'shopbuilder' ),
268 ],
269 'dependency' => [
270 'rules' => [
271 [
272 'item' => 'general.ai_implementation.ai_tools',
273 'value' => 'Gemini',
274 'operator' => '==',
275 ],
276 ],
277 ],
278 ],
279 */
280 'gemini_max_token' => [
281 'id' => 'gemini_max_token',
282 'label' => esc_html__( 'Gemini Maximum Characters', 'shopbuilder' ),
283 'type' => 'number',
284 'help' => esc_html__(
285 'Set the maximum character limit for Gemini model prompts. Adjust according to model capabilities and performance.',
286 'shopbuilder'
287 ),
288 'value' => 200,
289 'placeholder' => esc_html__( '200', 'shopbuilder' ),
290 'dependency' => [
291 'rules' => [
292 [
293 'item' => 'general.ai_implementation.ai_tools',
294 'value' => 'Gemini',
295 'operator' => '==',
296 ],
297 ],
298 ],
299 ],
300 // DeepSeek.
301 'deepseek_api_key' => [
302 'id' => 'deepseek_api_key',
303 'label' => esc_html__( 'DeepSeek API Key', 'shopbuilder' ),
304 'type' => 'password',
305 'placeholder' => esc_html__( 'ds-***********************', 'shopbuilder' ),
306 'help' => wp_kses(
307 __(
308 'To integrate with DeepSeek, you need to obtain an API key from DeepSeek. Visit <a href="https://www.deepseek.com/api-keys" target="_blank">DeepSeek API Keys</a> to generate one.',
309 'shopbuilder'
310 ),
311 [
312 'a' => [
313 'href' => [],
314 'target' => [],
315 ],
316 ]
317 ),
318 'dependency' => [
319 'rules' => [
320 [
321 'item' => 'general.ai_implementation.ai_tools',
322 'value' => 'DeepSeek',
323 'operator' => '==',
324 ],
325 ],
326 ],
327 ],
328 'deepseek_models' => [
329 'id' => 'deepseek_models',
330 'label' => esc_html__( 'DeepSeek Model', 'shopbuilder' ),
331 'type' => 'select',
332 'value' => 'gpt-4o',
333 'options' => [
334 'deepseek-chat' => __( 'DeepSeek Chat (Full Version)', 'shopbuilder' ),
335 'deepseek-reasoner' => __( 'DeepSeek Reasoner Mini (Light Version)', 'shopbuilder' ),
336 ],
337 'dependency' => [
338 'rules' => [
339 [
340 'item' => 'general.ai_implementation.ai_tools',
341 'value' => 'DeepSeek',
342 'operator' => '==',
343 ],
344 ],
345 ],
346 ],
347 'deepseek_max_token' => [
348 'id' => 'deepseek_max_token',
349 'label' => esc_html__( 'Deepshek Maximum Characters', 'shopbuilder' ),
350 'type' => 'number',
351 'help' => esc_html__(
352 'Set the maximum character limit for Deepshek model prompts. Adjust according to model configuration and speed requirements.',
353 'shopbuilder'
354 ),
355 'value' => 200,
356 'placeholder' => esc_html__( '200', 'shopbuilder' ),
357 'dependency' => [
358 'rules' => [
359 [
360 'item' => 'general.ai_implementation.ai_tools',
361 'value' => 'DeepSeek',
362 'operator' => '==',
363 ],
364 ],
365 ],
366 ],
367 'enable_semantic_search' => [
368 'id' => 'enable_semantic_search',
369 'type' => 'switch',
370 'label' => esc_html__( 'Enable Semantic Search?', 'shopbuilder' ),
371 'help' => esc_html__( 'Enable AI product search instead of keyword matching to get product', 'shopbuilder' ),
372 'dependency' => [
373 'rules' => [
374 [
375 'item' => 'general.ai_implementation.ai_tools',
376 'value' => [ 'OpenAI', 'Gemini' ],
377 'operator' => 'in',
378 ],
379 ],
380 ],
381 ],
382 'minimum_matching_percentage' => [
383 'id' => 'minimum_matching_percentage',
384 'label' => esc_html__( 'Minimum Accuracy (in percentage)', 'shopbuilder' ),
385 'help' => esc_html__( 'Set the minimum Accuracy. It is good between 40 and 60', 'shopbuilder' ),
386 'type' => 'number',
387 'min' => 1,
388 'max' => 99,
389 'value' => 40,
390 'placeholder' => esc_html__( '40', 'shopbuilder' ),
391 'dependency' => [
392 'rules' => [
393 [
394 'item' => 'general.ai_implementation.ai_tools',
395 'value' => [ 'OpenAI', 'Gemini' ],
396 'operator' => 'in',
397 ],
398 [
399 'item' => 'general.ai_implementation.enable_semantic_search',
400 'value' => 'on',
401 'operator' => '==',
402 ],
403 ],
404 ],
405 ],
406 'data_training' => [
407 'id' => 'data_training',
408 'type' => 'title',
409 'label' => esc_html__( 'Data Training', 'shopbuilder' ),
410 'dependency' => [
411 'rules' => [
412 [
413 'item' => 'general.ai_implementation.ai_tools',
414 'value' => [ 'OpenAI', 'Gemini' ],
415 'operator' => 'in',
416 ],
417 ],
418 ],
419 ],
420 'data_training_note_gemini' => $this->get_data_training_note_field( 'Gemini' ),
421 'data_training_note_openai' => $this->get_data_training_note_field( 'OpenAI' ),
422 'data_training_note_missing_openai_key' => $this->get_data_training_note_field( 'missingOpenAIKey' ),
423 'data_training_note_missing_gemneni_key' => $this->get_data_training_note_field( 'missingGeminiKey' ),
424 ],
425 ],
426 ),
427 'notification' => apply_filters(
428 'rtsb/settings/notification/options',
429 [
430 'id' => 'notification',
431 'category' => 'general',
432 'title' => esc_html__( 'Notification Settings', 'shopbuilder' ),
433 'package' => 'free',
434 'active_field' => [
435 'disable' => true,
436 ],
437 'fields' => [
438 'notification_intro' => [
439 'id' => 'notification_intro',
440 'type' => 'description',
441 'text' => esc_html__( 'Customize notifications for user actions such as adding items to cart, adding to wishlist, or comparing products.', 'shopbuilder' ),
442 ],
443 'notification_position' => [
444 'id' => 'notification_position',
445 'value' => 'center-center',
446 'type' => 'select',
447 'label' => esc_html__( 'Notification Position', 'shopbuilder' ),
448 'options' => [
449 'center-center' => esc_html__( 'Center Center', 'shopbuilder' ),
450 'top-right' => esc_html__( 'Top Right', 'shopbuilder' ),
451 'bottom-right' => esc_html__( 'Bottom Right', 'shopbuilder' ),
452 'bottom-left' => esc_html__( 'Bottom Left', 'shopbuilder' ),
453 'top-left' => esc_html__( 'Top Left', 'shopbuilder' ),
454 'top-center' => esc_html__( 'Top center', 'shopbuilder' ),
455 'bottom-center' => esc_html__( 'Bottom center', 'shopbuilder' ),
456 ],
457 ],
458 'notification_timeOut' => [
459 'id' => 'notification_timeOut',
460 'label' => esc_html__( 'Notification Time-Out (in seconds)', 'shopbuilder' ),
461 'type' => 'number',
462 'help' => esc_html__(
463 'Duration (in seconds) before the notification hides automatically.',
464 'shopbuilder'
465 ),
466 'min' => 1,
467 'max' => 20,
468 'value' => 5,
469 'placeholder' => esc_html__( '3', 'shopbuilder' ),
470 ],
471 'notification_color' => [
472 'id' => 'notification_color',
473 'label' => esc_html__( 'Text Color', 'shopbuilder' ),
474 'type' => 'color',
475 'tab' => 'floating_button',
476 ],
477 'notification_btn_color' => [
478 'id' => 'notification_color',
479 'label' => esc_html__( 'Button Color', 'shopbuilder' ),
480 'type' => 'color',
481 'tab' => 'floating_button',
482 ],
483 'notification_bg' => [
484 'id' => 'notification_bg',
485 'label' => esc_html__( 'Background Color', 'shopbuilder' ),
486 'type' => 'color',
487 'tab' => 'floating_button',
488 ],
489 'hide_notification' => [
490 'id' => 'hide_notification',
491 'type' => 'switch',
492 'label' => esc_html__( 'Hide Notifications', 'shopbuilder' ),
493 'help' => esc_html__( 'Enable this option if you don\'t want the notifications to show.', 'shopbuilder' ),
494 ],
495 ],
496 ],
497 ),
498 'social_share' => apply_filters(
499 'rtsb/settings/social_share/options',
500 [
501 'id' => 'social_share',
502 'category' => 'general',
503 'title' => esc_html__( 'Social Share Settings', 'shopbuilder' ),
504 'package' => 'free',
505 'active_field' => [
506 'disable' => true,
507 ],
508 'fields' => [
509 'social_share_intro' => [
510 'id' => 'social_share_intro',
511 'type' => 'description',
512 'text' => esc_html__( 'Configure social sharing platforms for products sharing.', 'shopbuilder' ),
513 ],
514 'share_platforms' => [
515 'id' => 'share_platforms',
516 'label' => esc_html__( 'Select Social Sharing Platforms', 'shopbuilder' ),
517 'type' => 'checkbox',
518 'orientation' => 'vertical',
519 'value' => [ 'facebook', 'twitter', 'linkedin' ],
520 'options' => Fns::social_share_platforms_list(),
521 ],
522 'share_platforms_to_product_page' => [
523 'id' => 'share_platforms_to_product_page',
524 'type' => 'switch',
525 'label' => esc_html__( 'Sharing Button in Single Product Page', 'shopbuilder' ),
526 'help' => esc_html__( 'Enable this option to allow share a product from product page. Woocommerce Supported Sharing plugins added to Hook: woocommerce_share', 'shopbuilder' ),
527 ],
528 'share_icon_layout' => [
529 'type' => 'select',
530 'value' => 'share-layout1',
531 'label' => esc_html__( 'Share Button Layout', 'shopbuilder' ),
532 'options' => [
533 'share-layout1' => esc_html__( 'Layout 1', 'shopbuilder' ),
534 'share-layout2' => esc_html__( 'Layout 2', 'shopbuilder' ),
535 ],
536 'dependency' => [
537 'rules' => [
538 [
539 'item' => 'general.social_share.share_platforms_to_product_page',
540 'value' => 'on',
541 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
542 ],
543 ],
544 ],
545 ],
546 ],
547 ],
548 ),
549 'guest_user' => apply_filters(
550 'rtsb/settings/guest_user/options',
551 [
552 'id' => 'guest_user',
553 'category' => 'general',
554 'title' => esc_html__( 'Guest User Controls', 'shopbuilder' ),
555 'package' => $this->pro_package(),
556 'active_field' => [
557 'disable' => true,
558 ],
559 ],
560 ),
561 'tooltip' => apply_filters(
562 'rtsb/settings/tooltip/options',
563 [
564 'id' => 'tooltip',
565 'category' => 'general',
566 'title' => esc_html__( 'Tooltip Settings', 'shopbuilder' ),
567 'package' => $this->pro_package(),
568 'active_field' => [
569 'disable' => true,
570 ],
571 ],
572 ),
573 'billing_form' => apply_filters(
574 'rtsb/settings/billing_form/options',
575 [
576 'id' => 'billing_form',
577 'category' => 'checkout',
578 'title' => esc_html__( 'Billing Form Settings', 'shopbuilder' ),
579 'package' => 'free',
580 'active_field' => [
581 'label' => esc_html__( 'Customize Billing Form Fields?', 'shopbuilder' ),
582 'help' => esc_html__( 'Switch on to customize billing form fields.', 'shopbuilder' ),
583 ],
584 'fields' => [
585 'checkout_billing_info' => [
586 'id' => 'checkout_billing_info',
587 'type' => 'title',
588 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ),
589 'customClass' => 'checkout-notice',
590 ],
591 'billing_first_name_heading' => [
592 'id' => 'billing_first_name_heading',
593 'type' => 'title',
594 'label' => esc_html__( 'First Name', 'shopbuilder' ),
595 ],
596 'billing_first_name' => [
597 'id' => 'billing_first_name',
598 'label' => esc_html__( 'First name', 'shopbuilder' ),
599 'type' => 'checkbox',
600 'orientation' => 'vertical',
601 'value' => [ 'show', 'required' ],
602 'options' => [
603 [
604 'value' => 'show',
605 'label' => 'Show First name?',
606 ],
607 [
608 'value' => 'required',
609 'label' => 'Required Field',
610 ],
611 ],
612 ],
613 'billing_first_name_label' => [
614 'id' => 'billing_first_name_label',
615 'label' => esc_html__( 'First name Label', 'shopbuilder' ),
616 'type' => 'text',
617 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
618 'dependency' => [
619 'rules' => [
620 [
621 'item' => 'general.billing_form.billing_first_name',
622 'value' => 'show',
623 'operator' => '==',
624 ],
625 ],
626 ],
627 ],
628 'billing_first_name_placeholder' => [
629 'id' => 'billing_first_name_placeholder',
630 'label' => esc_html__( 'First name Placeholder', 'shopbuilder' ),
631 'type' => 'text',
632 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
633 'dependency' => [
634 'rules' => [
635 [
636 'item' => 'general.billing_form.billing_first_name',
637 'value' => 'show',
638 'operator' => '==',
639 ],
640 ],
641 ],
642 ],
643
644 'billing_last_name_heading' => [
645 'id' => 'billing_last_name_heading',
646 'type' => 'title',
647 'label' => esc_html__( 'Last Name', 'shopbuilder' ),
648 ],
649 'billing_last_name' => [
650 'id' => 'billing_last_name',
651 'label' => esc_html__( 'Last name', 'shopbuilder' ),
652 'type' => 'checkbox',
653 'orientation' => 'vertical',
654 'value' => [ 'show', 'required' ],
655 'options' => [
656 [
657 'value' => 'show',
658 'label' => 'Show Last name?',
659 ],
660 [
661 'value' => 'required',
662 'label' => 'Required Field',
663 ],
664 ],
665 ],
666
667 'billing_last_name_label' => [
668 'id' => 'billing_last_name_label',
669 'label' => esc_html__( 'Last name label', 'shopbuilder' ),
670 'type' => 'text',
671 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
672 'dependency' => [
673 'rules' => [
674 [
675 'item' => 'general.billing_form.billing_last_name',
676 'value' => 'show',
677 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
678 ],
679 ],
680 ],
681 ],
682 'billing_last_name_placeholder' => [
683 'id' => 'billing_last_name_placeholder',
684 'label' => esc_html__( 'Last name Placeholder', 'shopbuilder' ),
685 'type' => 'text',
686 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
687 'dependency' => [
688 'rules' => [
689 [
690 'item' => 'general.billing_form.billing_last_name',
691 'value' => 'show',
692 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
693 ],
694 ],
695 ],
696 ],
697
698 'billing_company_heading' => [
699 'id' => 'billing_company_heading',
700 'type' => 'title',
701 'label' => esc_html__( 'Company', 'shopbuilder' ),
702 ],
703 'billing_company' => [
704 'id' => 'billing_company',
705 'label' => esc_html__( 'Company name', 'shopbuilder' ),
706 'type' => 'checkbox',
707 'orientation' => 'vertical',
708 'value' => [
709 'show',
710 'required' === get_option( 'woocommerce_checkout_company_field', 'optional' ) ? 'required' : 'optional',
711 ],
712 'options' => [
713 [
714 'value' => 'show',
715 'label' => 'Show company name?',
716 ],
717 [
718 'value' => 'required',
719 'label' => 'Required Field',
720 ],
721 ],
722 ],
723
724 'billing_company_label' => [
725 'id' => 'billing_company_label',
726 'label' => esc_html__( 'Company label', 'shopbuilder' ),
727 'type' => 'text',
728 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
729 'dependency' => [
730 'rules' => [
731 [
732 'item' => 'general.billing_form.billing_company',
733 'value' => 'show',
734 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
735 ],
736 ],
737 ],
738 ],
739 'billing_company_placeholder' => [
740 'id' => 'billing_company_placeholder',
741 'label' => esc_html__( 'Company Placeholder', 'shopbuilder' ),
742 'type' => 'text',
743 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
744 'dependency' => [
745 'rules' => [
746 [
747 'item' => 'general.billing_form.billing_company',
748 'value' => 'show',
749 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
750 ],
751 ],
752 ],
753 ],
754
755 'billing_country_heading' => [
756 'id' => 'billing_country_heading',
757 'type' => 'title',
758 'label' => esc_html__( 'Country', 'shopbuilder' ),
759 ],
760 'billing_country' => [
761 'id' => 'billing_country',
762 'label' => esc_html__( 'Country', 'shopbuilder' ),
763 'type' => 'checkbox',
764 'orientation' => 'vertical',
765 'value' => [ 'show', 'required' ],
766 'options' => [
767 [
768 'value' => 'show',
769 'label' => 'Show Country?',
770 ],
771 [
772 'value' => 'required',
773 'label' => 'Required Field',
774 ],
775 ],
776 ],
777
778 'billing_country_label' => [
779 'id' => 'billing_country_label',
780 'label' => esc_html__( 'Country label', 'shopbuilder' ),
781 'type' => 'text',
782 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
783 'dependency' => [
784 'rules' => [
785 [
786 'item' => 'general.billing_form.billing_country',
787 'value' => 'show',
788 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
789 ],
790 ],
791 ],
792 ],
793 'billing_address_1_heading' => [
794 'id' => 'billing_address_1_heading',
795 'type' => 'title',
796 'label' => esc_html__( 'Address 1', 'shopbuilder' ),
797 ],
798 'billing_address_1' => [
799 'id' => 'billing_address_1',
800 'label' => esc_html__( 'Address 1', 'shopbuilder' ),
801 'type' => 'checkbox',
802 'orientation' => 'vertical',
803 'value' => [ 'show', 'required' ],
804 'options' => [
805 [
806 'value' => 'show',
807 'label' => 'Show Address field?',
808 ],
809 [
810 'value' => 'required',
811 'label' => 'Required Field',
812 ],
813 ],
814 ],
815
816 'billing_address_1_label' => [
817 'id' => 'billing_address_1_label',
818 'label' => esc_html__( 'Address 1 label', 'shopbuilder' ),
819 'type' => 'text',
820 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
821 'dependency' => [
822 'rules' => [
823 [
824 'item' => 'general.billing_form.billing_address_1',
825 'value' => 'show',
826 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
827 ],
828 ],
829 ],
830 ],
831 'billing_address_1_placeholder' => [
832 'id' => 'billing_address_1_placeholder',
833 'label' => esc_html__( 'Address 1 Placeholder', 'shopbuilder' ),
834 'type' => 'text',
835 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
836 'dependency' => [
837 'rules' => [
838 [
839 'item' => 'general.billing_form.billing_address_1',
840 'value' => 'show',
841 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
842 ],
843 ],
844 ],
845 ],
846 'billing_address_2_heading' => [
847 'id' => 'billing_address_2_heading',
848 'type' => 'title',
849 'label' => esc_html__( 'Address 2', 'shopbuilder' ),
850 'dependency' => [
851 'rules' => [
852 [
853 'item' => 'general.billing_form.billing_address_1',
854 'value' => 'show',
855 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
856 ],
857 ],
858 ],
859 ],
860 'billing_address_2' => [
861 'id' => 'billing_address_2',
862 'label' => esc_html__( 'Address 2', 'shopbuilder' ),
863 'type' => 'checkbox',
864 'orientation' => 'vertical',
865 'value' => [
866 'show',
867 'required' === get_option( 'woocommerce_checkout_address_2_field', 'optional' ) ? 'required' : 'optional',
868 ],
869 'options' => [
870 [
871 'value' => 'show',
872 'label' => 'Show Address field?',
873 ],
874 ],
875 'help' => esc_html__( 'if "Address 1" is hidden then this field also hides.', 'shopbuilder' ),
876 'dependency' => [
877 'rules' => [
878 [
879 'item' => 'general.billing_form.billing_address_1',
880 'value' => 'show',
881 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
882 ],
883 ],
884 ],
885 ],
886
887 'billing_address_2_label' => [
888 'id' => 'billing_address_2_label',
889 'label' => esc_html__( 'Address 2 label', 'shopbuilder' ),
890 'type' => 'text',
891 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
892 'dependency' => [
893 'rules' => [
894 [
895 'item' => 'general.billing_form.billing_address_1',
896 'value' => 'show',
897 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
898 ],
899 [
900 'item' => 'general.billing_form.billing_address_2',
901 'value' => 'show',
902 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
903 ],
904 ],
905 ],
906 ],
907 'billing_address_2_placeholder' => [
908 'id' => 'billing_address_2_placeholder',
909 'label' => esc_html__( 'Address 2 Placeholder', 'shopbuilder' ),
910 'type' => 'text',
911 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
912 'dependency' => [
913 'rules' => [
914 [
915 'item' => 'general.billing_form.billing_address_1',
916 'value' => 'show',
917 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
918 ],
919 [
920 'item' => 'general.billing_form.billing_address_2',
921 'value' => 'show',
922 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
923 ],
924 ],
925 ],
926 ],
927 'billing_city_heading' => [
928 'id' => 'billing_city_heading',
929 'type' => 'title',
930 'label' => esc_html__( 'Town / City', 'shopbuilder' ),
931 ],
932 'billing_city' => [
933 'id' => 'billing_city',
934 'label' => esc_html__( 'Town / City', 'shopbuilder' ),
935 'type' => 'checkbox',
936 'orientation' => 'vertical',
937 'value' => [ 'show', 'required' ],
938 'options' => [
939 [
940 'value' => 'show',
941 'label' => 'Show Town / City?',
942 ],
943 [
944 'value' => 'required',
945 'label' => 'Required Field',
946 ],
947 ],
948
949 ],
950 'billing_city_label' => [
951 'id' => 'billing_city_label',
952 'label' => esc_html__( 'Town / City label', 'shopbuilder' ),
953 'type' => 'text',
954 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
955 'dependency' => [
956 'rules' => [
957 [
958 'item' => 'general.billing_form.billing_city',
959 'value' => 'show',
960 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
961 ],
962 ],
963 ],
964 ],
965 'billing_city_placeholder' => [
966 'id' => 'billing_city_placeholder',
967 'label' => esc_html__( 'City placeholder', 'shopbuilder' ),
968 'type' => 'text',
969 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
970 'dependency' => [
971 'rules' => [
972 [
973 'item' => 'general.billing_form.billing_city',
974 'value' => 'show',
975 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
976 ],
977 ],
978 ],
979 ],
980 'billing_state_heading' => [
981 'id' => 'billing_city_heading',
982 'type' => 'title',
983 'label' => esc_html__( 'State', 'shopbuilder' ),
984 ],
985 'billing_state' => [
986 'id' => 'billing_state',
987 'label' => esc_html__( 'State', 'shopbuilder' ),
988 'type' => 'checkbox',
989 'orientation' => 'vertical',
990 'value' => [ 'show', 'required' ],
991 'options' => [
992 [
993 'value' => 'show',
994 'label' => 'Show State?',
995 ],
996 [
997 'value' => 'required',
998 'label' => 'Required Field',
999 ],
1000 ],
1001 ],
1002
1003 'billing_state_label' => [
1004 'id' => 'billing_state_label',
1005 'label' => esc_html__( 'State label', 'shopbuilder' ),
1006 'type' => 'text',
1007 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1008 'dependency' => [
1009 'rules' => [
1010 [
1011 'item' => 'general.billing_form.billing_state',
1012 'value' => 'show',
1013 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1014 ],
1015 ],
1016 ],
1017 ],
1018 'billing_postcode_heading' => [
1019 'id' => 'billing_postcode_heading',
1020 'type' => 'title',
1021 'label' => esc_html__( 'Postcode / ZIP', 'shopbuilder' ),
1022 ],
1023 'billing_postcode' => [
1024 'id' => 'billing_postcode',
1025 'label' => esc_html__( 'Postcode / ZIP', 'shopbuilder' ),
1026 'type' => 'checkbox',
1027 'orientation' => 'vertical',
1028 'value' => [ 'show', 'required' ],
1029 'options' => [
1030 [
1031 'value' => 'show',
1032 'label' => 'Show Postcode / ZIP?',
1033 ],
1034 [
1035 'value' => 'required',
1036 'label' => 'Required Field',
1037 ],
1038 ],
1039 ],
1040 'billing_postcode_label' => [
1041 'id' => 'billing_postcode_label',
1042 'label' => esc_html__( 'Postcode / ZIP label', 'shopbuilder' ),
1043 'type' => 'text',
1044 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1045 'dependency' => [
1046 'rules' => [
1047 [
1048 'item' => 'general.billing_form.billing_postcode',
1049 'value' => 'show',
1050 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1051 ],
1052 ],
1053 ],
1054 ],
1055 'billing_postcode_placeholder' => [
1056 'id' => 'billing_postcode_placeholder',
1057 'label' => esc_html__( 'Postcode / ZIP placeholder', 'shopbuilder' ),
1058 'type' => 'text',
1059 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1060 'dependency' => [
1061 'rules' => [
1062 [
1063 'item' => 'general.billing_form.billing_postcode',
1064 'value' => 'show',
1065 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1066 ],
1067 ],
1068 ],
1069 ],
1070 'billing_phone_heading' => [
1071 'id' => 'billing_phone_heading',
1072 'type' => 'title',
1073 'label' => esc_html__( 'Phone', 'shopbuilder' ),
1074 ],
1075 'billing_phone' => [
1076 'id' => 'billing_phone',
1077 'label' => esc_html__( 'Phone', 'shopbuilder' ),
1078 'type' => 'checkbox',
1079 'orientation' => 'vertical',
1080 'value' => [
1081 'show',
1082 'required' === get_option( 'woocommerce_checkout_phone_field', 'required' ) ? 'required' : 'optional',
1083 ],
1084 'options' => [
1085 [
1086 'value' => 'show',
1087 'label' => 'Show Phone Field?',
1088 ],
1089 [
1090 'value' => 'required',
1091 'label' => 'Required Field',
1092 ],
1093 ],
1094
1095 ],
1096 'billing_phone_label' => [
1097 'id' => 'billing_phone_label',
1098 'label' => esc_html__( 'Phone field label', 'shopbuilder' ),
1099 'type' => 'text',
1100 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1101 'dependency' => [
1102 'rules' => [
1103 [
1104 'item' => 'general.billing_form.billing_phone',
1105 'value' => 'show',
1106 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1107 ],
1108 ],
1109 ],
1110 ],
1111 'billing_phone_placeholder' => [
1112 'id' => 'billing_phone_placeholder',
1113 'label' => esc_html__( 'Phone field placeholder', 'shopbuilder' ),
1114 'type' => 'text',
1115 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1116 'dependency' => [
1117 'rules' => [
1118 [
1119 'item' => 'general.billing_form.billing_phone',
1120 'value' => 'show',
1121 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1122 ],
1123 ],
1124 ],
1125 ],
1126 'billing_email_heading' => [
1127 'id' => 'billing_email_heading',
1128 'type' => 'title',
1129 'label' => esc_html__( 'Email', 'shopbuilder' ),
1130 ],
1131 'billing_email' => [
1132 'id' => 'billing_email',
1133 'label' => esc_html__( 'Email address', 'shopbuilder' ),
1134 'type' => 'checkbox',
1135 'orientation' => 'vertical',
1136 'value' => [ 'show', 'required' ],
1137 'options' => [
1138 [
1139 'value' => 'show',
1140 'label' => 'Show Email address Field?',
1141 ],
1142 [
1143 'value' => 'required',
1144 'label' => 'Required Field',
1145 ],
1146 ],
1147 ],
1148 'billing_email_label' => [
1149 'id' => 'billing_email_label',
1150 'label' => esc_html__( 'Email address field label', 'shopbuilder' ),
1151 'type' => 'text',
1152 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1153 'dependency' => [
1154 'rules' => [
1155 [
1156 'item' => 'general.billing_form.billing_email',
1157 'value' => 'show',
1158 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1159 ],
1160 ],
1161 ],
1162 ],
1163 'billing_email_placeholder' => [
1164 'id' => 'billing_email_placeholder',
1165 'label' => esc_html__( 'Email address field placeholder', 'shopbuilder' ),
1166 'type' => 'text',
1167 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1168 'dependency' => [
1169 'rules' => [
1170 [
1171 'item' => 'general.billing_form.billing_email',
1172 'value' => 'show',
1173 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1174 ],
1175 ],
1176 ],
1177 ],
1178 ],
1179
1180 ]
1181 ),
1182 'shipping_form' => apply_filters(
1183 'rtsb/module/shipping_form/options',
1184 [
1185 'id' => 'shipping_form',
1186 'category' => 'checkout',
1187 'title' => esc_html__( 'Shipping Form Settings', 'shopbuilder' ),
1188 'package' => 'free',
1189 'active_field' => [
1190 'label' => esc_html__( 'Customize Shipping form Fields?', 'shopbuilder' ),
1191 'help' => esc_html__( 'Switch on to customize shipping form fields.', 'shopbuilder' ),
1192 ],
1193 'fields' => [
1194 'checkout_shipping_info' => [
1195 'id' => 'checkout_shipping_info',
1196 'type' => 'title',
1197 'label' => __( 'The below form fields customization will be disabled when the <strong><u>Checkout Fields Editor</u></strong> module is activated.', 'shopbuilder' ),
1198 'customClass' => 'checkout-notice',
1199 ],
1200 'shipping_first_name_heading' => [
1201 'id' => 'shipping_first_name_heading',
1202 'type' => 'title',
1203 'label' => esc_html__( 'First Name', 'shopbuilder' ),
1204 ],
1205 'shipping_first_name' => [
1206 'id' => 'shipping_first_name',
1207 'label' => esc_html__( 'First name', 'shopbuilder' ),
1208 'type' => 'checkbox',
1209 'orientation' => 'vertical',
1210 'value' => [ 'show', 'required' ],
1211 'options' => [
1212 [
1213 'value' => 'show',
1214 'label' => 'Show First name?',
1215 ],
1216 [
1217 'value' => 'required',
1218 'label' => 'Required Field',
1219 ],
1220 ],
1221 ],
1222 'shipping_first_name_label' => [
1223 'id' => 'shipping_first_name_label',
1224 'label' => esc_html__( 'First name Label', 'shopbuilder' ),
1225 'type' => 'text',
1226 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1227 'dependency' => [
1228 'rules' => [
1229 [
1230 'item' => 'general.shipping_form.shipping_first_name',
1231 'value' => 'show',
1232 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1233 ],
1234 ],
1235 ],
1236 ],
1237 'shipping_first_name_placeholder' => [
1238 'id' => 'shipping_first_name_placeholder',
1239 'label' => esc_html__( 'First name Placeholder', 'shopbuilder' ),
1240 'type' => 'text',
1241 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1242 'dependency' => [
1243 'rules' => [
1244 [
1245 'item' => 'general.shipping_form.shipping_first_name',
1246 'value' => 'show',
1247 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1248 ],
1249 ],
1250 ],
1251 ],
1252 'shipping_first_last_heading' => [
1253 'id' => 'shipping_first_last_heading',
1254 'type' => 'title',
1255 'label' => esc_html__( 'Last Name', 'shopbuilder' ),
1256 ],
1257 'shipping_last_name' => [
1258 'id' => 'shipping_last_name',
1259 'label' => esc_html__( 'Last name', 'shopbuilder' ),
1260 'type' => 'checkbox',
1261 'orientation' => 'vertical',
1262 'value' => [ 'show', 'required' ],
1263 'options' => [
1264 [
1265 'value' => 'show',
1266 'label' => 'Show Last name?',
1267 ],
1268 [
1269 'value' => 'required',
1270 'label' => 'Required Field',
1271 ],
1272 ],
1273 ],
1274
1275 'shipping_last_name_label' => [
1276 'id' => 'shipping_last_name_label',
1277 'label' => esc_html__( 'Last name label', 'shopbuilder' ),
1278 'type' => 'text',
1279 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1280 'dependency' => [
1281 'rules' => [
1282 [
1283 'item' => 'general.shipping_form.shipping_last_name',
1284 'value' => 'show',
1285 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1286 ],
1287 ],
1288 ],
1289 ],
1290 'shipping_last_name_placeholder' => [
1291 'id' => 'shipping_last_name_placeholder',
1292 'label' => esc_html__( 'Last name Placeholder', 'shopbuilder' ),
1293 'type' => 'text',
1294 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1295 'dependency' => [
1296 'rules' => [
1297 [
1298 'item' => 'general.shipping_form.shipping_last_name',
1299 'value' => 'show',
1300 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1301 ],
1302 ],
1303 ],
1304 ],
1305 'shipping_company_heading' => [
1306 'id' => 'shipping_company_heading',
1307 'type' => 'title',
1308 'label' => esc_html__( 'Company', 'shopbuilder' ),
1309 ],
1310 'shipping_company' => [
1311 'id' => 'shipping_company',
1312 'label' => esc_html__( 'Company name', 'shopbuilder' ),
1313 'type' => 'checkbox',
1314 'orientation' => 'vertical',
1315 'value' => [ 'show', 'required' ],
1316 'options' => [
1317 [
1318 'value' => 'show',
1319 'label' => 'Show company name?',
1320 ],
1321 [
1322 'value' => 'required',
1323 'label' => 'Required Field',
1324 ],
1325 ],
1326 ],
1327
1328 'shipping_company_label' => [
1329 'id' => 'shipping_company_label',
1330 'label' => esc_html__( 'Company label', 'shopbuilder' ),
1331 'type' => 'text',
1332 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1333 'dependency' => [
1334 'rules' => [
1335 [
1336 'item' => 'general.shipping_form.shipping_company',
1337 'value' => 'show',
1338 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1339 ],
1340 ],
1341 ],
1342 ],
1343 'shipping_company_placeholder' => [
1344 'id' => 'shipping_company_placeholder',
1345 'label' => esc_html__( 'Shipping company Placeholder', 'shopbuilder' ),
1346 'type' => 'text',
1347 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1348 'dependency' => [
1349 'rules' => [
1350 [
1351 'item' => 'general.shipping_form.shipping_company',
1352 'value' => 'show',
1353 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1354 ],
1355 ],
1356 ],
1357 ],
1358 'shipping_country_heading' => [
1359 'id' => 'shipping_country_heading',
1360 'type' => 'title',
1361 'label' => esc_html__( 'Country', 'shopbuilder' ),
1362 ],
1363 'shipping_country' => [
1364 'id' => 'shipping_country',
1365 'label' => esc_html__( 'Country', 'shopbuilder' ),
1366 'type' => 'checkbox',
1367 'orientation' => 'vertical',
1368 'value' => [ 'show', 'required' ],
1369 'options' => [
1370 [
1371 'value' => 'show',
1372 'label' => 'Show Country?',
1373 ],
1374 [
1375 'value' => 'required',
1376 'label' => 'Required Field',
1377 ],
1378 ],
1379 ],
1380
1381 'shipping_country_label' => [
1382 'id' => 'shipping_country_label',
1383 'label' => esc_html__( 'Country label', 'shopbuilder' ),
1384 'type' => 'text',
1385 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1386 'dependency' => [
1387 'rules' => [
1388 [
1389 'item' => 'general.shipping_form.shipping_country',
1390 'value' => 'show',
1391 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1392 ],
1393 ],
1394 ],
1395 ],
1396 'shipping_address_1_heading' => [
1397 'id' => 'shipping_address_1_heading',
1398 'type' => 'title',
1399 'label' => esc_html__( 'Address 1', 'shopbuilder' ),
1400 ],
1401 'shipping_address_1' => [
1402 'id' => 'shipping_address_1',
1403 'label' => esc_html__( 'Address 1', 'shopbuilder' ),
1404 'type' => 'checkbox',
1405 'orientation' => 'vertical',
1406 'value' => [ 'show', 'required' ],
1407 'options' => [
1408 [
1409 'value' => 'show',
1410 'label' => 'Show Address field?',
1411 ],
1412 [
1413 'value' => 'required',
1414 'label' => 'Required Field',
1415 ],
1416 ],
1417 ],
1418
1419 'shipping_address_1_label' => [
1420 'id' => 'shipping_address_1_label',
1421 'label' => esc_html__( 'Address 1 label', 'shopbuilder' ),
1422 'type' => 'text',
1423 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1424 'dependency' => [
1425 'rules' => [
1426 [
1427 'item' => 'general.shipping_form.shipping_address_1',
1428 'value' => 'show',
1429 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1430 ],
1431 ],
1432 ],
1433 ],
1434 'shipping_address_1_placeholder' => [
1435 'id' => 'shipping_address_1_placeholder',
1436 'label' => esc_html__( 'Address 1 Placeholder', 'shopbuilder' ),
1437 'type' => 'text',
1438 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1439 'dependency' => [
1440 'rules' => [
1441 [
1442 'item' => 'general.shipping_form.shipping_address_1',
1443 'value' => 'show',
1444 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1445 ],
1446 ],
1447 ],
1448 ],
1449 'shipping_address_2_heading' => [
1450 'id' => 'shipping_address_2_heading',
1451 'type' => 'title',
1452 'label' => esc_html__( 'Address 2', 'shopbuilder' ),
1453 'dependency' => [
1454 'rules' => [
1455 [
1456 'item' => 'general.shipping_form.shipping_address_1',
1457 'value' => 'show',
1458 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1459 ],
1460 ],
1461 ],
1462 ],
1463 'shipping_address_2' => [
1464 'id' => 'shipping_address_2',
1465 'label' => esc_html__( 'Address 2', 'shopbuilder' ),
1466 'type' => 'checkbox',
1467 'orientation' => 'vertical',
1468 'value' => [ 'show' ],
1469 'options' => [
1470 [
1471 'value' => 'show',
1472 'label' => 'Show Address field?',
1473 ],
1474 ],
1475 'help' => esc_html__( 'if "Address 1" is hidden then this field also hides.', 'shopbuilder' ),
1476 'dependency' => [
1477 'rules' => [
1478 [
1479 'item' => 'general.shipping_form.shipping_address_1',
1480 'value' => 'show',
1481 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1482 ],
1483 ],
1484 ],
1485 ],
1486
1487 'shipping_address_2_label' => [
1488 'id' => 'shipping_address_2_label',
1489 'label' => esc_html__( 'Address 2 label', 'shopbuilder' ),
1490 'type' => 'text',
1491 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1492 'dependency' => [
1493 'rules' => [
1494 [
1495 'item' => 'general.shipping_form.shipping_address_1',
1496 'value' => 'show',
1497 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1498 ],
1499 [
1500 'item' => 'general.shipping_form.shipping_address_2',
1501 'value' => 'show',
1502 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1503 ],
1504 ],
1505 ],
1506 ],
1507 'shipping_address_2_placeholder' => [
1508 'id' => 'shipping_address_2_placeholder',
1509 'label' => esc_html__( 'Address 2 Placeholder', 'shopbuilder' ),
1510 'type' => 'text',
1511 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1512 'dependency' => [
1513 'rules' => [
1514 [
1515 'item' => 'general.shipping_form.shipping_address_1',
1516 'value' => 'show',
1517 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1518 ],
1519 [
1520 'item' => 'general.shipping_form.shipping_address_2',
1521 'value' => 'show',
1522 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1523 ],
1524 ],
1525 ],
1526 ],
1527 'shipping_city_heading' => [
1528 'id' => 'shipping_city_heading',
1529 'type' => 'title',
1530 'label' => esc_html__( 'Town / City', 'shopbuilder' ),
1531 ],
1532 'shipping_city' => [
1533 'id' => 'shipping_city',
1534 'label' => esc_html__( 'Town / City', 'shopbuilder' ),
1535 'type' => 'checkbox',
1536 'orientation' => 'vertical',
1537 'value' => [ 'show', 'required' ],
1538 'options' => [
1539 [
1540 'value' => 'show',
1541 'label' => 'Show Town / City?',
1542 ],
1543 [
1544 'value' => 'required',
1545 'label' => 'Required Field',
1546 ],
1547 ],
1548 ],
1549 'shipping_city_label' => [
1550 'id' => 'shipping_city_label',
1551 'label' => esc_html__( 'Town / City label', 'shopbuilder' ),
1552 'type' => 'text',
1553 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1554 'dependency' => [
1555 'rules' => [
1556 [
1557 'item' => 'general.shipping_form.shipping_city',
1558 'value' => 'show',
1559 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1560 ],
1561 ],
1562 ],
1563 ],
1564 'shipping_city_placeholder' => [
1565 'id' => 'shipping_city_placeholder',
1566 'label' => esc_html__( 'Shipping city placeholder', 'shopbuilder' ),
1567 'type' => 'text',
1568 'help' => esc_html__( 'Leave empty to set default.', 'shopbuilder' ),
1569 'dependency' => [
1570 'rules' => [
1571 [
1572 'item' => 'general.shipping_form.shipping_city',
1573 'value' => 'show',
1574 'operator' => '==', // 'operator' => 'any','in', !in' only valid for multiple value //
1575 ],
1576 ],
1577 ],
1578 ],
1579 'shipping_state_heading' => [
1580 'id' => 'shipping_state_heading',
1581 'type' => 'title',
1582 'label' => esc_html__( 'Others', 'shopbuilder' ),
1583 ],
1584 'shipping_state' => [
1585 'id' => 'shipping_state',
1586 'label' => esc_html__( 'State', 'shopbuilder' ),
1587 'type' => 'checkbox',
1588 'orientation' => 'vertical',
1589 'value' => [ 'show', 'required' ],
1590 'options' => [
1591 [
1592 'value' => 'show',
1593 'label' => 'Show State?',
1594 ],
1595 [
1596 'value' => 'required',
1597 'label' => 'Required Field',
1598 ],
1599 ],
1600 ],
1601 'shipping_postcode' => [
1602 'id' => 'shipping_postcode',
1603 'label' => esc_html__( 'Postcode / ZIP', 'shopbuilder' ),
1604 'type' => 'checkbox',
1605 'orientation' => 'vertical',
1606 'value' => [ 'show', 'required' ],
1607 'options' => [
1608 [
1609 'value' => 'show',
1610 'label' => 'Show Postcode / ZIP?',
1611 ],
1612 ],
1613 ],
1614
1615 ],
1616 ]
1617 ),
1618
1619 ];
1620
1621 if ( ! defined( 'ELEMENTOR_VERSION' ) ) {
1622 unset( $list['optimization']['fields']['load_elementor_scripts'] );
1623 }
1624 return apply_filters( 'rtsb/core/general_settings/raw_list', $list );
1625 }
1626
1627 /**
1628 * Get the Data Training Note field.
1629 *
1630 * @param string $tool Meta values.
1631 * @return array
1632 */
1633 public function get_data_training_note_field( $tool ): array {
1634 $progress = get_option( 'rtsb_embedding_progress', [ 'processed' => 0 ] );
1635 $total = AIFns::need_product_embedding();
1636 $processed = (int) $progress['processed'];
1637 $remaining = max( $total - $processed, 0 );
1638 $generate_url = add_query_arg(
1639 [
1640 rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
1641 'action' => 'rtsb_start_embedding_process',
1642 ],
1643 admin_url( 'admin.php?page=rtsb-settings' )
1644 );
1645
1646 if ( wp_next_scheduled( 'rtsb_embedding_cron_run' ) ) {
1647 $text = esc_html__( 'Processing embeddings in the background. You can continue using the site.', 'shopbuilder' );
1648 } else {
1649 if ( $remaining > 0 ) {
1650 // Build the correct text based on embedding progress.
1651 $text = sprintf(
1652 '%1$s <a class="rtsb-generate-embedding" href="%2$s">%3$s</a>',
1653 esc_html__( 'Make Compatible your existing products with semantic search process.', 'shopbuilder' ),
1654 esc_url( $generate_url ),
1655 esc_html__( 'Generate Embeddings', 'shopbuilder' )
1656 );
1657 } else {
1658 $text = esc_html__( '🎉 Congratulations! All your products are successfully embedded and up to date.', 'shopbuilder' );
1659 }
1660 }
1661 $note = [
1662 'OpenAI' => [
1663 'id' => 'data_training_note_openai',
1664 'type' => 'description',
1665 'text' => $text,
1666 'dependency' => [
1667 'rules' => [
1668 [
1669 'item' => 'general.ai_implementation.ai_tools',
1670 'value' => 'OpenAI',
1671 'operator' => '==',
1672 ],
1673 [
1674 'item' => 'general.ai_implementation.gpt_api_key',
1675 'value' => '',
1676 'operator' => '!=',
1677 ],
1678 ],
1679 ],
1680 ],
1681 'Gemini' => [
1682 'id' => 'data_training_note_gemini',
1683 'type' => 'description',
1684 'text' => $text,
1685 'dependency' => [
1686 'rules' => [
1687 [
1688 'item' => 'general.ai_implementation.ai_tools',
1689 'value' => 'Gemini',
1690 'operator' => '==',
1691 ],
1692 [
1693 'item' => 'general.ai_implementation.gemini_api_key',
1694 'value' => '',
1695 'operator' => '!=',
1696 ],
1697 ],
1698 ],
1699 ],
1700 'missingGeminiKey' => [
1701 'id' => 'data_training_note_missing_gemneni_key',
1702 'type' => 'description',
1703 'text' => esc_html__( 'Missing Gemini API key. Enter and save your API key to turn on the data training feature.', 'shopbuilder' ),
1704 'dependency' => [
1705 'rules' => [
1706 [
1707 'item' => 'general.ai_implementation.ai_tools',
1708 'value' => 'Gemini',
1709 'operator' => '==',
1710 ],
1711 [
1712 'item' => 'general.ai_implementation.gemini_api_key',
1713 'value' => '',
1714 'operator' => '==',
1715 ],
1716 ],
1717 ],
1718 ],
1719 'missingOpenAIKey' => [
1720 'id' => 'data_training_note_missing_openai_key',
1721 'type' => 'description',
1722 'text' => esc_html__( 'Missing OpenAI API key. Enter and save your API key to turn on the data training feature.', 'shopbuilder' ),
1723 'dependency' => [
1724 'rules' => [
1725 [
1726 'item' => 'general.ai_implementation.ai_tools',
1727 'value' => 'OpenAI',
1728 'operator' => '==',
1729 ],
1730 [
1731 'item' => 'general.ai_implementation.gpt_api_key',
1732 'value' => '',
1733 'operator' => '==',
1734 ],
1735 ],
1736 ],
1737 ],
1738 ];
1739 return $note[ $tool ] ?? [];
1740 }
1741 }
1742