diff --git a/wp-content/themes/twentytwentyfour/functions.php b/wp-content/themes/twentytwentyfour/functions.php index a692f39d..cc9c100f 100644 --- a/wp-content/themes/twentytwentyfour/functions.php +++ b/wp-content/themes/twentytwentyfour/functions.php @@ -228,52 +228,6 @@ function twentytwentyfour_test1_template( $template ) { } add_filter( 'template_include', 'twentytwentyfour_test1_template' ); -/** - * Use a standalone PHP template for the WooCommerce checkout page. - * - * @since Twenty Twenty-Four 1.0 - * - * @param string $template Resolved template path. - * @return string - */ -function twentytwentyfour_checkout_template( $template ) { - if ( ! function_exists( 'is_checkout' ) || ! is_checkout() || is_order_received_page() ) { - return $template; - } - - $custom_template = get_theme_file_path( 'page-checkout.php' ); - - if ( file_exists( $custom_template ) ) { - return $custom_template; - } - - return $template; -} -add_filter( 'template_include', 'twentytwentyfour_checkout_template', 20 ); - -/** - * Use a standalone PHP template for the WooCommerce cart page. - * - * @since Twenty Twenty-Four 1.0 - * - * @param string $template Resolved template path. - * @return string - */ -function twentytwentyfour_cart_template( $template ) { - if ( ! function_exists( 'is_cart' ) || ! is_cart() ) { - return $template; - } - - $custom_template = get_theme_file_path( 'page-cart.php' ); - - if ( file_exists( $custom_template ) ) { - return $custom_template; - } - - return $template; -} -add_filter( 'template_include', 'twentytwentyfour_cart_template', 20 ); - /** * Enqueue standalone landing assets for the page slug "test1". * @@ -281,9 +235,7 @@ add_filter( 'template_include', 'twentytwentyfour_cart_template', 20 ); * @return void */ function twentytwentyfour_test1_assets() { - $use_test1_assets = is_page( 'test1' ) - || ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) - || ( function_exists( 'is_cart' ) && is_cart() ); + $use_test1_assets = is_page( 'test1' ); if ( ! $use_test1_assets ) { return; @@ -291,8 +243,6 @@ function twentytwentyfour_test1_assets() { $css_file = ABSPATH . 'index3.css'; $js_file = ABSPATH . 'index3.js'; - $checkout_css_file = get_theme_file_path( 'assets/css/test1-checkout.css' ); - $checkout_js_file = get_theme_file_path( 'assets/js/test1-checkout.js' ); if ( is_page( 'test1' ) ) { wp_dequeue_style( 'global-styles' ); @@ -339,33 +289,6 @@ function twentytwentyfour_test1_assets() { } } - if ( ( ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) || ( function_exists( 'is_cart' ) && is_cart() ) ) && file_exists( $checkout_css_file ) ) { - wp_enqueue_style( - 'twentytwentyfour-test1-checkout-style', - get_theme_file_uri( 'assets/css/test1-checkout.css' ), - array( 'twentytwentyfour-test1-style' ), - (string) filemtime( $checkout_css_file ) - ); - } - - if ( ( ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) || ( function_exists( 'is_cart' ) && is_cart() ) ) && file_exists( $checkout_js_file ) ) { - wp_enqueue_script( - 'twentytwentyfour-test1-checkout-script', - get_theme_file_uri( 'assets/js/test1-checkout.js' ), - array(), - (string) filemtime( $checkout_js_file ), - true - ); - - wp_localize_script( - 'twentytwentyfour-test1-checkout-script', - 'test1CheckoutData', - array( - 'freeShippingThreshold' => twentytwentyfour_water_delivery_free_shipping_threshold(), - 'catalogUrl' => home_url( '/test1/#catalog' ), - ) - ); - } } add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_assets', 100 ); @@ -548,7 +471,6 @@ function twentytwentyfour_water_delivery_checkout_fields( $fields ) { return $fields; } -add_filter( 'woocommerce_checkout_fields', 'twentytwentyfour_water_delivery_checkout_fields' ); /** * Store bottle exchange choice in session during checkout refresh. @@ -563,7 +485,6 @@ function twentytwentyfour_water_delivery_update_order_review( $posted_data ) { WC()->session->set( 'tw_bottle_exchange', sanitize_text_field( wp_unslash( $data['tw_bottle_exchange'] ) ) ); } } -add_action( 'woocommerce_checkout_update_order_review', 'twentytwentyfour_water_delivery_update_order_review' ); /** * Add deposit fee if there is no bottle exchange. @@ -586,7 +507,6 @@ function twentytwentyfour_water_delivery_add_fees( $cart ) { $cart->add_fee( __( 'Залог за тару', 'twentytwentyfour' ), twentytwentyfour_water_delivery_deposit_fee(), false ); } } -add_action( 'woocommerce_cart_calculate_fees', 'twentytwentyfour_water_delivery_add_fees' ); /** * Validate custom checkout data. @@ -604,7 +524,6 @@ function twentytwentyfour_water_delivery_validate_checkout() { wc_add_notice( __( 'Укажите корректный телефон для подтверждения заказа.', 'twentytwentyfour' ), 'error' ); } } -add_action( 'woocommerce_checkout_process', 'twentytwentyfour_water_delivery_validate_checkout' ); /** * Save custom checkout fields to order meta. @@ -628,7 +547,6 @@ function twentytwentyfour_water_delivery_save_checkout_meta( $order_id ) { } } } -add_action( 'woocommerce_checkout_update_order_meta', 'twentytwentyfour_water_delivery_save_checkout_meta' ); /** * Add cart helper panel before the cart table. @@ -665,7 +583,6 @@ function twentytwentyfour_water_delivery_before_cart() {