• Resolved danhardkorr

    (@danhardkorr)


    Hey guys,

    I don’t need to display the cart page on my configurator, is there a way to send the add to cart button straight to the checkout page?

    Regards, Dan

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marc Lacroix

    (@marcusig)

    Hi Dan,

    This isn’t directly related to the configurator, as it uses WooCommerce’s built in add to cart system.

    But here’s an article showing how it can be done: https://www.businessbloomer.com/woocommerce-redirect-checkout-add-cart/

    (you’ll find many more articles on how to do this with a quick search, some of them offering plugin options)

    Marc

    Thread Starter danhardkorr

    (@danhardkorr)

    Thanks for the quick replay Marc,

    Unfortunately that method will completely disable the cart for all my products which i don’t want, i just need it for products that use the configurator.

    cheers

    dan

    Plugin Contributor Marc Lacroix

    (@marcusig)

    I see. Something like this will check if the product added to the cart is configurable:

    add_filter( 'woocommerce_add_to_cart_redirect', 'dan_redirect_checkout_add_cart', 20, 2 );
     
    function dan_redirect_checkout_add_cart( $url, $adding_to_cart = false ) {
       if ( ! function_exists( 'mkl_pc_is_configurable' ) ) return $url;
       if ( is_a( $adding_to_cart, 'WC_Product' ) && mkl_pc_is_configurable( $adding_to_cart->get_id() ) ) {
          return wc_get_checkout_url();
       }
       return $url;
    }

    Thread Starter danhardkorr

    (@danhardkorr)

    That works!!! Thanks Marc!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘redirect cart button straight to checkout page’ is closed to new replies.