we want to show our top pricing to guests but not allow guests to check out.. I read on the hiding pricing info page that hiding pricing also disallows checkout for guests. we want our pricing to show but not allow guest checkout,.
Our plugin doesn't have a direct feature for this.
However, I've written a code snippet to help in this situation;
if (!is_user_logged_in()){
global $b2bking_public;
// If go to checkout page, redirect to cart
add_action( 'template_redirect', array($b2bking_public, 'b2bking_checkout_redirect_to_cart'), 100 );
// Hide proceed to checkout button
remove_action( 'woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
// Hide cart totals entirely
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 );
// show message
add_action( 'woocommerce_before_cart', function(){
wc_print_notice( esc_html__('You need to be logged in, in order to be able to place orders.', 'b2bking'), 'error' );
}, 10);
}
we want to show our top pricing to guests but not allow guests to check out.. I read on the hiding pricing info page that hiding pricing also disallows checkout for guests. we want our pricing to show but not allow guest checkout,.
Hi there,
Our plugin doesn't have a direct feature for this.
However, I've written a code snippet to help in this situation;
A PHP snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/
It will look like this in Cart, for guests:
Kind regards,
Stefan
thank you very much...