to test is the text is not empty, try that :
function display_size_attribute() {
global $product;
if ($product->is_type('external')) {
$taxonomy = 'pa_maat';
$text = $product->get_attribute($taxonomy);
if (!empty($text)) {
echo "Maten:";
echo '<span class="attribute-size">'
. htmlspecialchars($text)
. '</span>';
}
} // END if ($product->is_type('external')) {
} // END function display_size_attribute() {
Related Posts:
- retrieve thumbnail from post ID of best selling product in category
- Woocommerce – remove product from category
- combine Code 1 with Code 2
- get current product name in functions.php
- Issue adding sub category programmatically
- Pass Category Name, Description and Photo into variables to pass to jQuery
- get taxonomy thumbnail and use it as a variable in code
- WooCommerce: Display product categories to make IF statement
- Display Sibling WooCommerce Product Categories on Archive Page
- Woocommerce. Get a list of products in the current category on the archive page and product page
- Add Custom Category Description When Empty
- Add a product category to a specific product via a button
- random woocommerce categories are not showing when count enabled?
- Need Quick Help With Product Category Page
- WordPress using get_term to retreive slug not working as expected
- Product Category Page in Full Width
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- How to correctly add Javascript in functions.php
- Looking to exclude blog posts from category Previous/Next buttons
- Woocommerce: How to override core functions in functions.php?
- Translating add to cart woocommerce button [closed]
- Add attribute / custom attribute to product in woocommerce
- How to exclude specific category from the get_the_category(); array
- How do I display a user’s previous orders as a select box option on a product?
- Adding nofollow to a PHP generated Nav
- Automated Cart Update With Alert Box Each Time
- Two Different Links for Same Product – WooCommerce [closed]
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- Show prices with tax in Woocommerce Mini Cart [closed]
- Problem with custom plugin using AJAX to pull info from php file
- Reload part of checkout on changed shipping method
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- Function works when I don’t login to WordPress but when I login then it doesn’t work
- How to make products with no cost in WooCommerce
- get_template_part based upon post’s category
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Different post styles depending on category
- Define specific category name in PHP
- Category title output before opening title tag
- Include Parent Term in wp_list_categories
- I’m trying to create an array with a foreach loop, but the array only stores the last item [closed]
- How to remove coupon dropdown feature
- Add html link in functions.php files of the theme
- Add product to cart for user – WC()->cart->add_to_cart [closed]
- Seo Friendly Filter URLs
- Remove page title in product page using a function
- woocommerce specific quantities for product
- How to get category name or ID by post?
- woocommerce related product title length
- Listing titles and custom fields of entries within subcategories
- random display categories – change url
- Do not duplicate posts with multiple categories in multiple loops
- WordPress site with embedded menu – gives You don’t have permission to access /wp-content/themes/xxx/taxonomy-redirect.php on this server
- Woocommerce custom Plugin in wordpress [closed]
- Adding wp_list_categories to a specific div that was appended using jQuery
- How to separate product payment and shipping payment in WooCommerce checkout? [closed]
- How to get woocommerce orders with get_posts method in a shortcode
- Counting number of posts in multiple (sub)categories using shortcode
- Woocommerce disable order item link (backend) [closed]
- Set all WooCommerce Products to Simple, Virtual & Downloadable
- Undefined array key 0 wp-includes/capabilities.php on line 76
- How do I know if the user is a customer?
- admin panel – How to remove “delete” button from category editing page
- I want to fusion the product columns in email table order
- WooCommerce is_product_category() not working
- Get parent category name when only child category is applied to a product
- Multiple Tag Filtering
- How do I programmatically add ‘reviews_allowed’ to WooCommerce product?
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Notice: Undefined variable
- Adding product permalink on admin order page throwing error
- Show subcategory name selected in specific category woocoommerce
- How to override WooCommerce Order Item Meta with data from Cart?
- How to get total gross revenue for current month in the woocommerce dashboard status widget
- Add custom attribute to product’s HTML to woocommerce cart page
- Change WooCommerce template for PDF – access to custom field
- How can i style “echo apply_filters”
- Get all woocommerce product names with price and show using core php
- How to properly create multiple conditions to redirect users roles to different pages
- How can i put php code on the wordpress page?
- PHP drop down menu for my get_category child of
- How do I prevent a folder from reappearing in my home directory?
- jQuery doesn’t work in my php snippet
- Rearrange get_categories array compared to another array
- Use WP_Query Data In Cookie
- Query seems to be duplicated
- Top menu disapears in Category Pages when filtering using ACF
- Remove the_content From Loop
- Category List in Theme Options Page
- How to add custom checkout field in user details mail template
- Add specific phrase after every product title including the discounted price? [closed]
- Display Sale Price Before Regular Price (WooCommerce)
- Setting WooCommerce currency programmatically
- WooCommerce – Show ‘Sales’ badge on variable products where only some variations have sales price [closed]
- How to create a container in php then customise it in CSS
- Show button in header when product custom field is not empty
- WordPress 6.1.1 UTF8 Slug Limit Increase
- Woocommerce Convert existing order to the cart
- How to change shipping method title based on cart amount?
- How to add SKU and remove product title from WooCommerce url?