PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.2.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.2.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / shortcode / checkout-form.php

checkout-form.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.2.0, at includes/shortcode/checkout-form.php

52 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace StoreEngine\Shortcode;
4
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 use StoreEngine\Utils\Formatting;
10 use StoreEngine\Utils\Helper;
11 use StoreEngine\Utils\Template;
12
13 class CheckoutForm {
14 public function __construct() {
15 add_shortcode( 'storeengine_checkout_form', array( $this, 'render_checkout_form' ) );
16 }
17
18 public function render_checkout_form(): string {
19 $cart = Helper::cart();
20 do_action( 'storeengine/cart/check_items' );
21 $is_cart_empty = $cart->is_cart_empty();
22 $cart_sub_total = $cart->get_cart_subtotal();
23 $products = $cart->get_cart_items();
24
25 if ( Formatting::string_to_bool( get_query_var( 'order_pay' ) ) ) {
26 $order = Helper::get_order( absint( get_query_var( 'order_id' ) ) );
27 if ( is_wp_error( $order ) ) {
28 return '';
29 }
30 } else {
31 $order = Helper::get_recent_draft_order();
32 }
33
34 $current_user_email = ( is_user_logged_in() ) ? wp_get_current_user()->user_email : '';
35 ob_start();
36
37 Template::get_template( 'shortcode/checkout-form.php', [
38 'is_cart_empty' => $is_cart_empty,
39 'cart_sub_total' => $cart_sub_total,
40 'products' => $products,
41 'product_query' => null,
42 'order' => $order,
43 'current_user_email' => $current_user_email,
44 'is_digital_cart' => $cart->needs_shipping(),
45 ] );
46
47 return ob_get_clean();
48 }
49
50
51 }
52