Closed. This question needs
I used this code with jquery script but cant seem to get it to work
function remove_tehnicki_karakteristiki() {
if ( !is_singular(['product']) ){
global $post, $product;
$short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt );
if (empty($short_description) ) {
echo '<script>
jQuery(#elementor-tab-title-1562).hide();
</script>';
}
}
}
CodePudding user response:
if only some section is empty that's means the short description is not empty
add this code jQuery:
function remove_tehnicki_karakteristiki() {
if ( !is_singular(['product']) ){ // only on product page
global $post, $product;
$short_description = apply_filters( 'woocommerce_short_description', $post->post_excerpt ); // get short desc
echo "
<script>
jQuery.each(jQuery('.elementor-section-wrap'), function (i, el) {
var sec = jQuery(el).text().replace(/\s /g, '');
if (sec == '' || sec == ' ') {
var p = jQuery(el).parents('.elementor-toggle-item');
p.hide();
}
});
</script>";
}
}