PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.0.0
ShopBuilder – WooCommerce Builder For Elementor v3.0.0
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 / Modules / CheckoutEditor / CheckoutEditorInit.php

CheckoutEditorInit.php in ShopBuilder – WooCommerce Builder For Elementor 3.0.0, at app/Modules/CheckoutEditor/CheckoutEditorInit.php

71 lines 1.8 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\Modules\CheckoutEditor;
4
5 // Do not allow directly accessing this file.
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit( 'This script cannot be accessed directly.' );
8 }
9
10
11 use RadiusTheme\SB\Helpers\Fns;
12 use RadiusTheme\SB\Models\GeneralList;
13 use RadiusTheme\SB\Traits\SingletonTrait;
14
15 /**
16 * CheckoutEditorInit
17 */
18 final class CheckoutEditorInit {
19 /**
20 * Singleton Trait.
21 */
22 use SingletonTrait;
23
24 /**
25 * @var array
26 */
27 private static $cache = [];
28
29 /**
30 * @var array|mixed
31 */
32 private array $options;
33
34 /**
35 * Notifications hooks.
36 */
37 private function __construct() {
38 // If the cached result doesn't exist, fetch it from the database.
39 global $checkout_editor_settings; // Define global variable.
40 $this->options = Fns::get_options( 'modules', 'checkout_fields_editor' ); // Assign options to the global variable.
41 $checkout_editor_settings = $this->options;
42 $this->disable_general_settings();
43 GeneralCheckout::instance();
44 if ( 'on' === ( $this->options['modify_billing_form'] ?? '' ) ) {
45 BillingFields::instance();
46 }
47 if ( 'on' === ( $this->options['modify_shipping_form'] ?? '' ) ) {
48 ShippingFields::instance();
49 }
50 if ( 'on' === ( $this->options['modify_additional_form'] ?? '' ) ) {
51 AdditionalFields::instance();
52 }
53 do_action( 'rtsb/checkout/editor/init' );
54 }
55
56 /**
57 * @return void
58 */
59 public function disable_general_settings() {
60 $elementor_list = GeneralList::instance()->get_data();
61 $billing_settings = $elementor_list['billing_form'] ?? [];
62 $shipping_form = $elementor_list['shipping_form'] ?? [];
63 if ( ! empty( $billing_settings['active'] ) ) {
64 Fns::set_options( 'general', 'billing_form', [ 'active' => '' ] );
65 }
66 if ( ! empty( $shipping_form['active'] ) ) {
67 Fns::set_options( 'general', 'shipping_form', [ 'active' => '' ] );
68 }
69 }
70 }
71