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
- Different wp_mail_from and wp_mail_from_name for specific situations
- post meta data clearing on autosave
- Restrict user registration to emails on a single domain
- Call to undefined add_action() in theme’s functions.php
- Passing HTML in WordPress Shortcode arguments
- Can I use require() function in a template file?
- What is the most efficient method for loading widgets in functions.php
- Add description text under input field for new profile fields
- Convert User ID’s to User Names in a single.php file
- password protected post policy
- Custom Shortcode, functions PHP WP_Query loop
- wpautop – disable tags, keep tags
- Logout hyperlink within a sub-menu
- How to add content at the end of posts?
- Manipulate Permalink
- Change the HTML of the comment form that is generating somewhere from the core WordPress
- How to get the index number of the posts?
- How to call particular funcion when the check box is checked in plugin options page
- Call WordPress function outside of WordPress
- media resize/crop possibilities?
- Hook into a function without a hook?
- Insert template-part inside the content
- Add unique id to Preview URL
- Latest Foursquare Checkin function
- PHP 7.1 | Warning: A non-numeric value encountered in
- Way to redirect all Product Sub Category to its Main category Page?
- Fatal error: Call to undefined function is_even()
- How to use parent theme functions in child theme functions.php file?
- Trying to update Woocommerce meta values
- Bulk updating a group of WordPress Pages every 10 minutes
- remove_filter function to unhook twentysixteen parent theme function
- Can we have conditional CSS styling?
- Change function without filter hook
- How to add javascript code into Divi child theme?
- What to do to have access to WordPress functions
- Changing the color of post title [closed]
- Create html from function
- WordPress not performing direct update
- How to add a class and title attribute to the link generated by next/previous post
- Bad value crossorigin for attribute crossorigin on element link
- Custom customizer CSS priority
- Custom HTML structure in customizer not rendring in Browser