Your cart is currently empty!
Add Quick Checkout Button Product Page WooCommerce – Redirect to Checkout Without Plugin
Adding Quick Checkout function to your WordPress shopping website on product page it will redirect customer directly to payment checkout page without using any plugin.
Here we share a simple code that can help to fast your checkout process most of out theme already have this feature included you can enable or disable from settings.
Before we start suggest you to take backup of theme in any situation you can restore is to default.
Add Quick Checkout button to Product page
First you need to open function.php file from Dashboard > Appearance > Theme Editor now choose file from right side of list.
You can also access file from FTP client then go to WordPress install directory > wp-content > YOUR_THEME > function.php
Now paste below code into theme file.
function insertcart_addtocart_button_func() {
// echo content.
global $product;
$pid = $product->get_id();
$quicklink = WC()->cart->get_checkout_url();
echo '<div class="button quickcheckout"><a href="'.$quicklink.'?add-to-cart='.$pid.'">'.esc_attr('Quick Checkout').'</a></div>';
}
add_action( 'woocommerce_after_add_to_cart_button', 'insertcart_addtocart_button_func' );
Above code will show Quick checkout button just after Add to cart button.
Additionally you can add css to button as well.
.button.quickcheckout {
border-radius: 5px;
clear: both;
margin-top: 10px;
padding: 8px;
background: #339ad5;
}
Comments
2 responses to “Add Quick Checkout Button Product Page WooCommerce – Redirect to Checkout Without Plugin”
Hi thanks a lot, this has been the only solution working for me. All the plugin redirects are broken.
Although , i cant seem use variable products, i get the error : PLEASE CHOOSE PRODUCT OPTIONSโฆ
Is there any fix? Thanks in advanceI don’t thing that above code with work on variable product because it grab product ID and take you to checkout page.For variable product you need diff. ID that means many quick checkout button as I understand for now.
Grabber Pro
Original price was: $59.$39Current price is: $39.Insertcart Custom WooCommerce Checkbox Ultimate
Original price was: $39.$19Current price is: $19.Android App for Your Website
Original price was: $49.$35Current price is: $35.Abnomize Pro
Original price was: $30.$24Current price is: $24.Medical Portfolio Pro
Original price was: $31.$24Current price is: $24.
Latest Posts
- How to Handle Sudden Traffic Spike in Website – Do Node Balancer Really Help
- How to Use AWS SES Email from Localhost or Website: Complete Configuration in PHP
- How to Upload Images and PDFs in Android Apps Using Retrofit
- [Fix] File Permission Issue in Apache Website WordPress Not Writable to 775
- Best PHP ini Settings for WordPress & WooCommerce: Official Recommendations
Leave a Reply