Skip to content

Instantly share code, notes, and snippets.

@ibrahim-kardi
Created October 26, 2021 07:55
Show Gist options
  • Save ibrahim-kardi/d5b686ad392517d237a8426b2c787a3e to your computer and use it in GitHub Desktop.
Save ibrahim-kardi/d5b686ad392517d237a8426b2c787a3e to your computer and use it in GitHub Desktop.
function add_buynow_after_addtocart() {
// get the current post/product ID
$product_id = tutor_utils()->get_course_product_id();
// get the "Checkout Page" URL
$checkout_url = wc_get_checkout_url();
// Buy now button
echo '<a href="'.$checkout_url.'?add-to-cart='.$product_id.'">Buy Now</a>';
}
add_action( 'tutor_after_add_to_cart_button', 'add_buynow_after_addtocart' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment