Skip to content

Instantly share code, notes, and snippets.

@geotsiokos
Created March 20, 2020 10:40
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 geotsiokos/6a0d78ea2e6152ca971c50c9cacf0ecf to your computer and use it in GitHub Desktop.
Save geotsiokos/6a0d78ea2e6152ca971c50c9cacf0ecf to your computer and use it in GitHub Desktop.
Modifies the product description shown on WPS live search results
add_filter( 'woocommerce_product_search_field_product_description', 'wpsrd_woocommerce_product_search_field_product_description', 10, 2 );
function wpsrd_woocommerce_product_search_field_product_description( $description, $post_id ) {
if ( $post_id == 32 ) { // here you should use the product id you desire instead of 32
$description = 'a description'; // write a description enclosed in single quotes
}
return $description;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment