WooCommerce: Redirect to Checkout after Add to Cart
There are instances where a person may want to redirect the user to checkout after adding items to cart ie. if they use Woocommerce booking appointment and can only book one time. The below code snippet allows for changing the behaviour of the Add to Cart button. Code add_filter( 'woocommerce_add_to_cart_redirect', 'themename_add_to_cart_redirect' ); function themename_add_to_cart_redirect( $url ) { return get_permalink( get_option( 'woocommerce_checkout_page_id' ) ); } Where to add this Code snippet? Usually, the code is added in functions.php of your child theme. As shown below: /path/to/wordpress/wp-content/themes/mytheme-child/functions.php I don't have access to this functions.php As an alternative, you can also install and use a plugin called Code Snippets from the admin. Log into your WordPress admin Click Plugins Click Add New Search for Code Snippets Click Install Now under "Code Snippets" Activ...