• Resolved krzakx

    (@krzakx)


    Hey!
    I do look for code snippet that will let me change default behaviour of Add to cart button (the one avaiable in Gutenborg as a block) from
    either adds the product to the cart, or links to the product page.
    into
    either redirect to chekcout or links to the product page (if products variants avaiable).

    Thank you for support.

    • This topic was modified 2 years, 8 months ago by krzakx.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Raif Deari

    (@rdeari)

    Hi @krzakx!

    That is certainly possible. Here are the steps:

    1. Head to WooCommerce > Settings > Products and make sure that Redirect to the cart page after successful addition is checked
    2. Next, add the following snippet:
    function redirect_checkout_add_cart( ) {
        return wc_get_checkout_url();
    }
    add_filter ('woocommerce_add_to_cart_redirect', 'redirect_checkout_add_cart' );

    That should do the trick 😉

    Thread Starter krzakx

    (@krzakx)

    I do confirm.
    I does do the trick!
    Thank you for your support!

    Plugin Support Raif Deari

    (@rdeari)

    Howdy @krzakx !

    Happy to hear that it is working for you!

    Have a great one 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Direct checkout’ is closed to new replies.