In this simple tutorial, we shared a solution on how to put woocommerce shopping cart and payment on one page. This greatly optimizes the checkout process and does not wait for other pages to load, so customers can save a lot of time. You can use this solution if you want to save additional steps in high priced products that sell about one product per order. Woocommerce shopping carts and customers who regularly shop online on one page always need a fast checkout process. If the loading speed is slow or you redirect to another page before payment, you can choose another store. The main reason why many people use woocommerce in online stores is that it can be modified.
Woocommerce’s default payment process has two separate pages for shopping cart and payment. I would like to introduce how to put woocommerce shopping cart and payment on one page to improve the user experience and improve the conversion rate. This will be the ultimate guide, as it mixes shortcut code, settings, and PHP snipt that can be used to do this. This may seem complicated, but if I follow the steps I want to share sharply, it will be easier to find than I thought. This is mainly because the problem of giving up the shopping basket occurs in the multi-stage payment process, and the sales of woocommerce stores are more likely to increase.
In addition to all this, here is a simple step-by-step guide that puts shopping carts and checkout on the same page. In addition, woocommerce testing and tracking can be performed to determine whether the conversion rate is better. Log in to the WordPress site at the stage of the woocomerce shopping cart and put the payment on one page, and access the dashboard as an administrator. In the panel menu, click shape Menu > theme editor menu. After opening the theme editor page, browse the theme function file to add the function of putting cart and checkout in one page. Add the following code at the end of the PHP file: That is, the shortcut code \
*Shopping cart @ check out page only – woocomerce
*\/
add_action( ‘woocommerce_before_checkout_form’, ‘njengah_cart_on_checkout_page_only’, 5 );
Function njengah_cart_on_checkout_page_only (){
Return if (is_wc_endpoint_url (\
Echo do_shortcode (\
}Refresh the checkout page to view the results, as shown below: If you are familiar with the shopping cart page layout, you can understand the total part of the shopping cart. The concise code I share will automatically hide the summary, because there are two shortcut codes on the same page. This is a good function.
Although the trick can be executed in short code, a little investigation will find that the shopping cart page is still independent. In addition, the shopping cart is cleared on the checkout page, and woocommerce redirects the user to the shopping cart page and displays an empty shopping cart message. This means that you need to make some adjustments to change it. The shopping cart page must be completely deleted to prevent users from seeing it. On the WordPress dashboard, click wordmerge > settings. On the settings page, click the Advanced tab and click the small \
Male then delete the shopping cart page. No longer useful, there are already redirects, shopping cart tables
Because it is already on the settlement page. However, if you want to redirect an empty checkout page when the user directly accesses or the shopping cart table is empty, here are some gadgets. This helps redirect the empty checkout page to the home page. In the panel menu, click shape Menu > theme editor menu. If the topic editor page opens, browse the topic feature file to add the ability to redirect empty checkout pages to the home page.
Add the following code at the end of the PHP file:\/**
*Empty shopping cart \/ check-out redirection woocomerce
*\/
add_action( ‘template_redirect’, ‘njengah_redirect_empty_cart_checkout_to_home’ );
Function njengah_redirect_empt_cart_checkout_to_home (){
if ( is_cart() && is_checkout() && 0 == WC()->cart->get_cart_contents_count() && ! is_wc_endpoint_url( ‘order-pay’ ) && ! is_wc_endpoint_url( ‘order-received’ ) ) {
wp_safe_redirect( home_url() );
exit;
}
}To view the results, after deleting all products in the shopping cart, you will be redirected to the home page as follows: That’s the conclusion! Now that your payment process has been optimized, you don’t have to worry about giving up your shopping cart at woocommerce store. In the first snipt, we add the \
In addition, a bonus PHP code snipt has been added to help redirect empty checkout. I hope this short post can solve the problem of how to put woocommerce cart and checkout on one page. How to change the icon of the woocomer payment gateway in similar articles? How to add the woocomer payment icon [HTML] in the footer? How to hide the PayPal icon in the woocomer payment page? How to resize the image of the woocomer product? How to redirect the WordPress page without a plug-in? How to install woocommerce storefront step by step [complete guide] Change from woocommerce to payment text, display the method of woocommerce products by category, hide the quantity field on woocommerce products page, or delete the method of hiding shopping cart subtotal or deleting subtotal line in woocommerce, hide the method of coupon code field in woocommerce, and disable the payment method of specific category in woocommerce How to hide the Add button in the shopping cart woocommerce to get the payment method? How to create my account page in code ye woocommerce what is the theme of woocommerce store front desk? [answer] how to redirect to the shopping basket after logging in woocommerce woocommerce shop page change the method of adding button text in the shopping basket skip the shopping basket redirect to the settlement page woocommerce woocommerce \