Skip to content

Conversation

wprashed
Copy link

This code allows customers to instantly purchase a product with a single click, skipping the cart page, and proceeding directly to the checkout page with the product already in their cart.

This code allows customers to instantly purchase a product with a single click, skipping the cart page, and proceeding directly to the checkout page with the product already in their cart.
Copy link

@manojsiddoji manojsiddoji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_filter('add_to_cart_redirect', 'cw_redirect_add_to_cart');
function cw_redirect_add_to_cart() {
global $woocommerce;
$cw_redirect_url_checkout = $woocommerce->cart->get_checkout_url();
return $cw_redirect_url_checkout;
}
//theme folders functions.php
add_filter( 'woocommerce_product_single_add_to_cart_text', 'cw_btntext_cart' );

add_filter( 'woocommerce_product_add_to_cart_text', 'cw_btntext_cart' );

function cw_btntext_cart() {

return __( 'Buy Me', 'woocommerce' );

}

Copy link

@manojsiddoji manojsiddoji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can skip the cart page and redirect to the checkout page by adding the above code snippet to the functions.php file in your theme folder:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants