Hi
I installed ALMS on a fresh dev-site and also added WooCommerce.
I have created a course & connected with a Woo-Product, but now I want to be able to streamline the purchase-process.
Currently, it requires the visitor to apply many clicks, before he finishes the purchase and gets enrolled.
I would like to replace the “Add to cart” button with a “Buy now” button, which will automatically add the product to the cart and redirects the visitor to the checkout.
How can I achieve this?
I have already tried to apply this code-snippet:
function redirect_to_checkout() {
// Check if the user is on a product page or the shop page
if (is_product() || is_shop()) {
// Redirect to the checkout page
wp_safe_redirect(wc_get_checkout_url());
exit;
}
}
add_action('template_redirect', 'redirect_to_checkout');but it does not work on ALMS-course-pages.
Can you help me with this?
Kind regards
Sascha
