Put Cart & Checkout on the Same Page

First, you need to add the “woocommerce_cart” shortcode to the Checkout page. In this way we’re telling WooCommerce we want to have the cart table on top and the checkout form below it.

 * @snippet       Display Cart on Checkout Page Only - WooCommerce
 * @author        Codeithub
add_action( 'woocommerce_before_checkout_form', 'codeithub_cart_on_checkout_page_only', 5 );
function codeithub_cart_on_checkout_page_only() {
if ( is_wc_endpoint_url( 'order-received' ) ) return;
echo do_shortcode('[woocommerce_cart]');
Checkout and cart on the same page

Leave a Reply

Your email address will not be published. Required fields are marked *