правки checkout cart

This commit is contained in:
2026-04-04 20:35:13 +03:00
parent 4cb3d9199e
commit 214380a4e5
4 changed files with 328 additions and 108 deletions

View File

@@ -228,6 +228,52 @@ function twentytwentyfour_test1_template( $template ) {
}
add_filter( 'template_include', 'twentytwentyfour_test1_template' );
/**
* Use a lightweight custom 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 lightweight custom 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".
*
@@ -292,6 +338,37 @@ function twentytwentyfour_test1_assets() {
}
add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_assets', 100 );
/**
* Enqueue shared test1 header/footer styles for cart and checkout.
*
* @since Twenty Twenty-Four 1.0
* @return void
*/
function twentytwentyfour_test1_shared_shell_assets() {
if ( ! ( ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() ) || ( function_exists( 'is_cart' ) && is_cart() ) ) ) {
return;
}
$shared_shell_css = get_theme_file_path( 'assets/css/test1-shared-shell.css' );
wp_enqueue_style(
'twentytwentyfour-test1-fonts',
'https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&display=swap',
array(),
null
);
if ( file_exists( $shared_shell_css ) ) {
wp_enqueue_style(
'twentytwentyfour-test1-shared-shell-style',
get_theme_file_uri( 'assets/css/test1-shared-shell.css' ),
array( 'twentytwentyfour-test1-fonts' ),
(string) filemtime( $shared_shell_css )
);
}
}
add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_shared_shell_assets', 110 );
/**
* Free shipping threshold for custom notices.
*