WooCommerce Term Meta Is Deprecated, Use This Instead.
Useful Links
Around the Web
Contact
Based in the
United Kingdom.
In May 2016, Google reported that 20% of its mobile queries were voice searches.
— CMO
Are you having issues with what to use instead of woocommerce_term_meta
?
What you can use instead is get_term_meta
.
Here’s an example below:
If you want to display WooCommerce Product Category thumbnails on the current product category archive, use this code instead whilst you are on the product category archive page, or simply any other archive page for that matter since in the example below we used get_queried_object_id()
:
$background_image = get_term_meta( get_queried_object_id(), 'thumbnail_id', true );
$background_image
using the function get_term_meta()
with 3 function parameters:get_queried_object_id()
is the ID of the current post (which I am hoping you are querying the product_cat
term object in this example. Of course, this is a very generic example and should be replaced with the proper value for this parameter'thumbnail_id'
is the term meta keytrue
is to set the returned value of the function as singular, i.e. not within an array for example.Based in the
United Kingdom.
In May 2016, Google reported that 20% of its mobile queries were voice searches.