I found the code below online and it works great. It creates a "one page" checkout. Only problem is, the "cart is updated" message on the checkout when changing the quantity of a product. I need to remove it.
Here's the code I'm using to get a "one page" checkout:
// creates a combined cart and checkout page
add_action( 'woocommerce_before_checkout_form', 'one_page_checkout', 5 );
function one_page_checkout() {
if ( is_wc_endpoint_url( 'order-received' ) ) return; ?>
<div class="one-page-checkout-cart"><?php echo do_shortcode('[woocommerce_cart]'); ?></div>
<?php
}
// on empty cart when on checkout, redirect to home page
add_action( 'template_redirect', 'redirect_on_empty_checkout' );
function redirect_on_empty_checkout() {
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( 'shop' );
exit; } }
// removes coupon field form checkout, do not use CSS for this
add_action( 'woocommerce_before_checkout_form', 'remove_checkout_coupon_form_for_one_page_checkout', 9 );
function remove_checkout_coupon_form_for_one_page_checkout(){
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
}
For "cart is updated" message, this is the code that I'm using. It works great on the checkout, but it also removes the "added to cart" message on the product page.
add_filter( 'woocommerce_add_message', 'unset_atc_html_from_one_page_checkout' );
function unset_atc_html_from_one_page_checkout() {
global $woocommerce;
if (is_checkout() ) {
add_filter('woocommerce_add_message', '__return_false');
}}
Kindly help getting the "cart updated" message removed from checkout while keeping the "added to cart" message on the product page.