Created
August 12, 2020 09:49
-
-
Save jamesckemp/41368f4bccfdbc0de2ad443ca80b5c9b to your computer and use it in GitHub Desktop.
Use parent description for variation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use parent's description. | |
*/ | |
function iconic_woocommerce_short_description( $description ) { | |
if ( ! is_archive() ) { | |
return $description; | |
} | |
global $product; | |
$parent_id = $product->get_parent_id(); | |
if ( $parent_id <= 0 ) { | |
return $description; | |
} | |
return get_the_excerpt( $parent_id ); | |
}; | |
add_filter( 'woocommerce_short_description', 'iconic_woocommerce_short_description', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment