This topic has 9 replies, 2 voices, and was last updated 2 years, 7 months ago ago by Olga Barlow
Hi,
I want users to redirect to the checkout page when woo-commerce individually sold products have already been added to the cart.
Now following code is working fine with other themes but why it is not working with your theme.
Individually sold product Add to cart URL – https://attnsatishk.sg-host.com/hi-vichar-niyam/
I have added this code in WP Admin –> Snippet –> Add New
add_filter( 'woocommerce_add_to_cart_sold_individually_found_in_cart', 'handsome_bearded_guy_maybe_redirect_to_cart' );
function handsome_bearded_guy_maybe_redirect_to_cart( $found_in_cart ) {
if ( $found_in_cart ) {
wp_safe_redirect( wc_get_page_permalink( 'checkout' ) );
exit;
}
return $found_in_cart;
}
Hello,
Provide us with FTP access to your site.
Regards
Hi,
Please add PHP code using Snippets only, so that I can switch on-off this functionality whenever needed
WP Admin –> Snippet –> Add New
Hello,
I passed your issue to our developers. I’ll inform you about the results.
Regards
Any update on this
please check
Hello,
I’m sorry but we tried to enable snippet and enabled the default WooCommerce theme Storefront and it does not work https://recordit.co/MN6ijxROCn
So, provide us with the video where it works for you for better understanding, please.
Regards
It’s working check here (product link give in privet area)
Add this product to the cart and try to add it 2nd time into the cart, you will get redirected to the checkout page
Hello,
Oh, I see. Ok, then go to Theme Options > WooCommerce > Single product builder > Add to cart > disable AJAX Add To Cart For Simple And Variable Products option https://prnt.sc/IrNElKeDIILz Then it works. You can’t use Ajax add to cart if you want to use that.
Regards
Tagged: best selling, cart, checkout, redirect, themes, woocommerce
The issue related to '‘Redirect to checkout page when sold individually found in cart’' has been successfully resolved, and the topic is now closed for further responses