default.php
56 lines
| 1 | <?php |
| 2 | /** |
| 3 | * This template will overwrite the WooCommerce file: woocommerce/templates/checkout/form-checkout.php. |
| 4 | */ |
| 5 | |
| 6 | defined('ABSPATH') || exit; |
| 7 | $editor_mode = ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) ; |
| 8 | if(get_post_type() == \ShopEngine\Core\Template_Cpt::TYPE) { |
| 9 | wc()->frontend_includes(); |
| 10 | |
| 11 | if(empty(WC()->cart->cart_contents)) { |
| 12 | |
| 13 | WC()->session = new WC_Session_Handler(); |
| 14 | WC()->session->init(); |
| 15 | WC()->customer = new WC_Customer(get_current_user_id(), true); |
| 16 | WC()->cart = new WC_Cart(); |
| 17 | |
| 18 | $demo_products = get_posts( |
| 19 | [ |
| 20 | 'post_type' => 'product', |
| 21 | 'numberposts' => 1, |
| 22 | 'post_status' => 'publish', |
| 23 | 'fields' => 'ids', |
| 24 | 'orderby' => 'ID', |
| 25 | 'order' => 'DESC', |
| 26 | ] |
| 27 | ); |
| 28 | |
| 29 | if(!empty($demo_products)) { |
| 30 | foreach($demo_products as $id) { |
| 31 | WC()->cart->add_to_cart($id); |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | ?> |
| 37 | |
| 38 | <div class="shopengine-checkout-review-order"> |
| 39 | |
| 40 | <?php do_action('woocommerce_checkout_before_order_review_heading'); ?> |
| 41 | <h3 id="order_review_heading"><?php esc_html_e('Your order', 'shopengine'); ?></h3> |
| 42 | |
| 43 | <div id="order_review" class="woocommerce-checkout-review-order"> |
| 44 | <?php do_action('woocommerce_checkout_before_order_review'); ?> |
| 45 | <?php |
| 46 | if($editor_mode){ |
| 47 | include_once ShopEngine::widget_dir() . 'checkout-review-order/screens/review-order-template.php'; |
| 48 | }else{ |
| 49 | woocommerce_order_review(); |
| 50 | } |
| 51 | ?> |
| 52 | </div> |
| 53 | <?php do_action('woocommerce_checkout_after_order_review'); ?> |
| 54 | </div> |
| 55 | <?php |
| 56 |