Home Forums WoodMart support forum Additional check in meta-value.php if empty meta key value

Additional check in meta-value.php if empty meta key value

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #536535

    supp0rt
    Participant

    Hello,

    I am working on a new site and I am using woodmart Layouts. Inside the single product layout, I used the element “product meta value” and It worked perfectly as long as the meta_key had a value. The problem that I faced was that if the meta_key that I had set in the element was empty the value and the field was still there.

    So I would like to ask if it is possible in the themes > woodmart > inc > modules > layouts > wpb > shortcodes > single-product > meta-value.php to add this kind of check

     $meta_value = get_post_meta( get_the_ID(), $settings['meta_key'], true );
    
        	if ( empty($meta_value) ) {
            	return '';
        	}

    so that it will not display at all the div, if there is no value inside the meta_key?

    Feel free to adjust the code if something is wrong or if I miss something.

    Best Regards

    • This topic was modified 10 months, 3 weeks ago by supp0rt. Reason: Fixed a typo
    #536721

    Artem Temos
    Keymaster

    Hello,

    Thank you for your suggestion. We will consider adding an option to hide empty meta values for our future updates.

    Kind Regards

    #537548

    supp0rt
    Participant

    That’s all I wanted. I will kindly ask if this is possible to be added to the next update of the theme (version 7.4.4), as it would make me enable it and not change the file directly to add it.

    None the less I understand that everyone manages their time accordingly and also their tasks. So I will leave it up to you. Thank you for your time.

    Best Regards

    #537558

    Artem Temos
    Keymaster

    We will consider adding this ability in our 7.5 update.

    Kind Regards

    #537582

    supp0rt
    Participant

    Thank you. You may close this ticket.

    Best Regards

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Additional check in meta-value.php if empty meta key value’ is closed to new replies.