Skip to content

Instantly share code, notes, and snippets.

@jrick1229
Last active January 19, 2021 16:47
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 jrick1229/b39c851aafd4751261345f4208d9e40c to your computer and use it in GitHub Desktop.
Save jrick1229/b39c851aafd4751261345f4208d9e40c to your computer and use it in GitHub Desktop.
Add custom add to cart text (below add to cart button) on certain product IDs.
<?php
add_action( 'woocommerce_after_add_to_cart_button', 'custom_after_add_to_cart_btn' );
function custom_after_add_to_cart_btn(){
global $product;
$id = $product->get_id();
$product_ids = array( 501, 176 );
if(in_array( $id, $product_ids)) {
echo 'Some custom text here';
} else { return; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment