Skip to content

Instantly share code, notes, and snippets.

@bryceadams
Last active September 15, 2016 18:17
Show Gist options
  • Save bryceadams/96f080b5118c8f1fdf20 to your computer and use it in GitHub Desktop.
Save bryceadams/96f080b5118c8f1fdf20 to your computer and use it in GitHub Desktop.
<?php
// Change 'add to cart' text on single product page (depending on product IDs)
add_filter( 'woocommerce_product_single_add_to_cart_text', 'bryce_id_multiple_add_to_cart_text' );
function bryce_id_multiple_add_to_cart_text( $default ) {
if ( get_the_ID() == 386 ) {
return __( 'Yes! I WANT this!', 'your-slug' );
} elseif ( get_the_ID() == 125 ) {
return __( 'This is number 125! Add!', 'your-slug' );
} elseif ( get_the_ID() == 225 ) {
return __( 'Add number 225 too!', 'your-slug' );
} else {
return $default;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment