How to streamline enrollment/purchase? | WordPress.org

[ad_1]

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

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer