Skip to content

Instantly share code, notes, and snippets.

@mburnette
Created July 23, 2020 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mburnette/bae95cd1a650078a0ae6ad3b91b53630 to your computer and use it in GitHub Desktop.
Save mburnette/bae95cd1a650078a0ae6ad3b91b53630 to your computer and use it in GitHub Desktop.
[Custom button next to "Add to Cart"] Adds a custom button next to the "Add to Cart" button #WooCommerce
<?php // only copy this line if needed
/**
* Custom button next to "Add to Cart"
*/
function sv_wc_shop_secondary_button() {
$button_link = 'https://google.com';
$button_text = 'Pay in Installments';
echo '<a class="button alt demo_button" style="margin-left: 8px;" href="'.$button_link.'">'.$button_text.'</a>';
}
add_action( 'woocommerce_after_shop_loop_item', 'sv_wc_shop_secondary_button', 20 );
add_action( 'woocommerce_after_add_to_cart_button', 'sv_wc_shop_secondary_button', 20 );
@azizouha
Copy link

Worked fine for me , i used a css editor to make some visual adjustments

@azizouha
Copy link

Tahnk you for sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment