Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update functions.php #2171

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Update functions.php #2171

wants to merge 1 commit into from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants