I’m assuming what you want is to hide the text when meta is empty.
You can put a conditional check for meta before print:
add_action( 'woocommerce_single_product_summary', 'also_available_on_ps4', 38 );
function also_available_on_ps4() {
global $product;
if ( has_term( 'ps4-games', 'product_cat' ) ) {
if(get_post_meta( get_the_ID(), 'also_available', true )){
echo '<b>Also available on:</b>' . get_post_meta( get_the_ID(), 'also_available', true );
}
}
}
Related Posts:
- How to display custom field in woocommerce orders in admin panel?
- Programatically add options to “add new” custom field dropdown
- Get a list of all available fields in the User Profile
- Enabling shortcodes for custom fields
- Add options to featured image
- Authors details such as social media links, emails etc → Is this Meta or something else?
- Assign category using custom field?
- Function to Download External Images to My Site
- Checked() showing up twice in custom fields
- How to use max and min values of custom fields
- Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host
- Customizer field value into functions.php variable
- Auto delete post if certain custom field data is empty
- How to display custom option field in woocommerce orders in admin panel?
- How to add a slide toggle to the Woocommerce-Layout__Activity-Panel area in the orders admin page
- What WordPress function to use to get meta value by using meta keys?
- Removing custom meta data
- Change label for registration Fields
- Custom Attachment Caption Fields
- Default Custom Field Value Automatically Update
- WordPress function saves a post twice and updates all posts
- ACF not showing
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- How to get correct value from checked()?
- Prevent custom field from being updated after first publish
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Programmatically add Yoast meta description after post save
- Insert Address fields into function
- How to make custom comment fields required
- How add body_class from wp_termmeta
- How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]
- Sort and display pages with specific custom field (not tag)
- shorthand syntax for custom fields
- Fill empty custom field with other custom field
- Perform function on publish AND save (not just save)
- How to Display WooCommerce Product Price in WooCommerce Archive
- How to change text color depending on the number value (Using javascript)
- wp_set_object_term via js btn frontend
- Populate Product Regular Price with a calculated ACF Field Value
- How Can I Concatenate A String With One Of My Custom Field Value Before Saving The Post?
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- Create New User Custom Field not Saving
- Creating a “Related Meta” type field?
- How would I correctly implement a new if statement in a child functions file?
- How To Show Shortcodes In WordPress Custom Fields?
- How to echo the translated custom field?
- How to add function to custom fields when page/post has a password?
- How to exclude posts with empty and non-existent relational custom field with meta_query?
- Post date on Custom field
- Dynamically generated Navigation Diagram using Custom Fields
- Define an extra field for all pages (with no plugin?)
- update_post_meta not working in function
- Adding custom field in menu options [duplicate]
- How to display data from custom fields in my custom shortcode?
- Syling Custom Fields echo’s from from functions.php
- Add custom fields after post/page title
- Adding and updating repeating custom field meta data
- Change Post status based on custom field date +1 day
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- Link to user’s profile settings page?
- Shared functions.php across multiple WordPress websites
- How to restrict actions and filters “properly” by conditions
- AJAX handler throws 400 (Bad request) – why?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Conditional tag is_page with a custom post type
- Enqueue styles after a plugin
- Super simple shortcode not working
- Using “Read More” link with custom excerpt
- what function can I use to automatically output og tags per page/post?
- Add error message on password protected page ONLY when password introduced was incorrect
- Where to start learning more about wordpress templates [closed]
- Reuse variable in hook callback
- What does this code do? (Injected code hacked)
- Is my code correct to enqueue CSS on a specific page?
- Dequeue Script Using Functions.php
- Using $WPDB to create simple array to check against user entered value
- Create custom function for hero image
- How to add data to a custom field at the wp_users table?
- Specify multiple categories for custom post template – FATAL ERROR
- If is_single in functions.php
- How to conditionally add a widget via a hook in functions.php
- Unescape attribute the_title() on CDATA in RSS feed
- get_image_tag() html output : empty src attribute
- Warning at top of website & top menu gone
- Show ‘Add to Cart’ on Out of Stock products
- Pass post ID from archive template to functions file
- Competing Login Redirects – Need to be Combined?
- How to add styles in existing function?
- get_comments not working properly after WordPress v4.4 update
- What add_action reference should I be using or should I use do_action?
- Allow the access over wp-login.php
- Create input select image URL?
- Including one page with WordPress functions into another
- Dynamically Generating User Meta Field
- Check if there is an post to be published in future
- Unhook the comment form in Buddypress
- Working function() doesn’t execute when triggered by WP CRON
- WordPress – Notice: Function wp_enqueue_script was called incorrectly
- post_row_actions filter from parent theme not executing in child theme