Redirect to checkout page when sold individually found in cart

This topic has 9 replies, 2 voices, and was last updated 2 years, 6 months ago ago by Olga Barlow

  • Avatar: DS
    DS
    Participant
    May 19, 2022 at 12:20

    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;
    }
    Please, contact administrator
    for this information.
    8 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 20, 2022 at 11:42

    Hello,

    Provide us with FTP access to your site.

    Regards

    Avatar: DS
    DS
    Participant
    May 20, 2022 at 11:47

    Hi,

    Please add PHP code using Snippets only, so that I can switch on-off this functionality whenever needed

    WP Admin –> Snippet –> Add New

    Please contact administrator
    for this information.
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 20, 2022 at 15:26

    Hello,

    I passed your issue to our developers. I’ll inform you about the results.

    Regards

    Avatar: DS
    DS
    Participant
    May 23, 2022 at 06:23

    Any update on this

    Avatar: DS
    DS
    Participant
    May 23, 2022 at 10:58

    please check

    Please contact administrator
    for this information.
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 23, 2022 at 15:25

    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

    Avatar: DS
    DS
    Participant
    May 23, 2022 at 16:26

    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

    Please contact administrator
    for this information.
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 23, 2022 at 16:48

    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

  • Viewing 9 results - 1 through 9 (of 9 total)

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

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.