Skip to content

Instantly share code, notes, and snippets.

@rashmimalpande
Created September 27, 2017 10:50
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 rashmimalpande/c4738b6e6685f4bc8c44b10c407ac145 to your computer and use it in GitHub Desktop.
Save rashmimalpande/c4738b6e6685f4bc8c44b10c407ac145 to your computer and use it in GitHub Desktop.
public function add_after_add_to_cart() {
global $post;
$product_id = $post->ID;
$categories = get_the_terms( $product_id, 'product_cat' );
if( empty( $categories ) ) {
return;
}
foreach( $categories as $cat ) {
if( 'men' == $cat->slug ) {
echo "<img src='safe_checkout1.png' >"; //add image url in the src attribute
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment