woocomerce refresh cart total code example
Example: add to cart page refresh sumit woocommerce
add_action( 'woocommerce_add_to_cart_redirect', 'prevent_duplicate_products_redirect' );
function prevent_duplicate_products_redirect( $url = false ) {
// if another plugin gets here first, let it keep the URL
if( !empty( $url ) ) {
return $url;
}
// redirect back to the original page, without the 'add-to-cart' parameter.
// we add the 'get_bloginfo' part so it saves a redirect on https:// sites.
return get_bloginfo( 'wpurl' ).add_query_arg( array(), remove_query_arg( 'add-to-cart' ) );
} // end function