Anton | настройка cart
This commit is contained in:
@@ -251,6 +251,29 @@ function twentytwentyfour_checkout_template( $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".
|
||||
*
|
||||
@@ -258,7 +281,9 @@ add_filter( 'template_include', 'twentytwentyfour_checkout_template', 20 );
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_test1_assets() {
|
||||
$use_test1_assets = is_page( 'test1' ) || ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() );
|
||||
$use_test1_assets = is_page( 'test1' )
|
||||
|| ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() )
|
||||
|| ( function_exists( 'is_cart' ) && is_cart() );
|
||||
|
||||
if ( ! $use_test1_assets ) {
|
||||
return;
|
||||
@@ -306,13 +331,14 @@ function twentytwentyfour_test1_assets() {
|
||||
'test1WooCommerce',
|
||||
array(
|
||||
'addToCartUrl' => WC_AJAX::get_endpoint( 'add_to_cart' ),
|
||||
'cartUrl' => wc_get_cart_url(),
|
||||
'checkoutUrl' => wc_get_checkout_url(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( function_exists( 'is_checkout' ) && is_checkout() && ! is_order_received_page() && file_exists( $checkout_css_file ) ) {
|
||||
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' ),
|
||||
|
||||
Reference in New Issue
Block a user