woocommerce buy now button – How to add a Woocommerce buy now button?

woocommerce buy now button – Add A Buy Now Button With Your Add To Cart Button On Woocommerce. In this post, i will know How to add a buy now button in woocommerce without a plugin?

WooCommerce Buy Now helps you to add products to cart and checkout.

woocommerce buy now button

A fastly buy button is a button on a E-commerce website that allows a customer to buy an item immediately. Add ‘Buy Now’ button in WooCommerce and then User clicks on any product displayed on Home/Shop page. ·

add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );

How to Add Buy Now Button in WooCommerce without Plugin?

theme functions.php


function add_content_after_addtocart() {

$final_get_active_item_id = get_the_ID();

$product = wc_get_product( $final_get_active_item_id );

$wc_get_ref_check = wc_get_checkout_url();

if( $product->is_type( 'simple' ) ){
echo 'Buy Now';
}
}
add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );

Add Buy Now Button in WooCommerce

functions.php


function add_content_after_addtocart() {

$final_get_active_item_id = get_the_ID();


$product = wc_get_product( $final_get_active_item_id );


$wc_get_ref_check = wc_get_checkout_url();

	if( $product->is_type( 'simple' ) ){
		echo 'Buy Now';
	}
}

add_action( 'woocommerce_after_add_to_cart_button', 'add_content_after_addtocart' );

Don’t Miss : woocommerce sample data csv download

I hope you get an idea about woocommerce buy now button.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment