Archived topic
Buy now button (WooCommerce)
4 replies · Started by Pedro on February 9, 2019
Hello! I hope you are well.
I would like to know if it is possible to add a buy button now next to the add button to the cart.
Something like AliExpress does, I leave a link to see:
https://en.aliexpress.com/store/product/GETIHU-Metal-Magnetic-Case-for-iPhone-XR-XS-MAX-X-8-Plus-7-Tempered-Glass-Back/2674091_32887991629.html? spm = a219c.search0604.3.1.18dc6a3byM6JvB & ws_ab_test = searchweb0_0, searchweb201602_2_10065_10068_10547_319_10059_10884_317_10548_10887_10696_321_322_10084_453_10083_454_10103_10618_10307_537_536_10902, searchweb201603_51, ppcSwitch_0 & algo_expid = 09e88cc5-2a51-4bf1-a6b0-358289ba9efb-0 & algo_pvid = 09e88cc5-2a51-4bf1-a6b0-358289ba9efb & transAbTest = ae803_5
I was searching the net and I see that it can. I tried to do it myself but I see that the GP files are different from other topics.
You just have to add a PHP and CSS code and that's it, I'd like that button to redirect to the checkout.
Thank you!
Hi there,
Something like this should work:
https://stackoverflow.com/questions/41588135/how-to-use-woocommerce-after-add-to-cart-button
The woocommerce_after_add_to_cart_button hook is included in our Hooks Element module:
https://docs.generatepress.com/article/hooks-element-overview/
Hi leo!
Can you be a little more specific? I added the hook as indicated in the guide, and it shows all the code on the product page.
What I want is to add a "Buy Now" button as they do in AliExpress, which when clicked redirects the client to the checkout.
I'm not sure what PHP code you will need to add.
This is something you will have to check with WooCommerce's support.
Keep in mind that GP's WooCommerce module only provide styles to the actual WooCommerce plugin and does not interfere with its functionalities.
I did find a couple plugins that might be helpful if you aren't comfortable with coding:
https://wordpress.org/plugins/woocommerce-quick-buy/
https://wordpress.org/plugins/woo-simple-buy-now/