Skip to content

Update functions.php#2171

Open
wprashed wants to merge 1 commit intowoocommerce:trunkfrom
wprashed:patch-2
Open

Update functions.php#2171
wprashed wants to merge 1 commit intowoocommerce:trunkfrom
wprashed:patch-2

Conversation

@wprashed
Copy link
Copy Markdown

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
Copy Markdown

@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
Copy Markdown

@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