WooCommerce Term Meta Is Deprecated, Use This Instead.
Are you having issues with what to use instead of
What you can use instead is
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
$background_imageusing the function
get_term_meta()with 3 function parameters:
- The integer returned by
get_queried_object_id()is the ID of the current post (which I am hoping you are querying the
product_catterm object in this example. Of course, this is a very generic example and should be replaced with the proper value for this parameter
- The string
'thumbnail_id'is the term meta key
- The boolean
trueis to set the returned value of the function as singular, i.e. not within an array for example.