PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.5
ShopBuilder – WooCommerce Builder For Elementor v3.2.5
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 / Controllers / Frontend / Ajax / UpdateCheckoutSection.php

UpdateCheckoutSection.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.5, at app/Controllers/Frontend/Ajax/UpdateCheckoutSection.php

59 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Add to Cart Ajax Class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Controllers\Frontend\Ajax;
9
10 use RadiusTheme\SB\Helpers\Fns;
11 use RadiusTheme\SB\Traits\SingletonTrait;
12
13 // Do not allow directly accessing this file.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit( 'This script cannot be accessed directly.' );
16 }
17
18 /**
19 * Add to Cart Ajax Class.
20 */
21 class UpdateCheckoutSection {
22 /**
23 * Singleton.
24 */
25 use SingletonTrait;
26
27 /**
28 * Class Constructor.
29 *
30 * @return void
31 */
32 private function __construct() {
33 add_action( 'wp_ajax_rtsb_shopify_checkout_section_update', [ $this, 'response' ] );
34 add_action( 'wp_ajax_nopriv_rtsb_shopify_checkout_section_update', [ $this, 'response' ] );
35 }
36
37 /**
38 * Ajax Response.
39 *
40 * @return void
41 */
42 public function response() {
43 WC()->cart->calculate_totals();
44 WC()->cart->calculate_shipping();
45 ob_start();
46 Fns::load_template( 'shopify-checkout/order-review-footer', [] );
47 $calculate = ob_get_clean();
48 ob_start();
49 Fns::load_template( 'shopify-checkout/shopify-shipping-method', [] );
50 $shipping_method = ob_get_clean();
51 wp_send_json_success(
52 [
53 'order_calculate' => $calculate,
54 'shipping_method' => $shipping_method,
55 ]
56 );
57 }
58 }
59