PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.4
ShopBuilder – WooCommerce Builder For Elementor v3.2.4
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.4, at app/Models/GeneralList.php

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