logomichael sumner

WooCommerce Term Meta Is Deprecated, Use This Instead.

Are you having issues with what to use instead ofwoocommerce_term_meta?

What you can use instead isget_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 );
The code above explains that we are creating a $background_image using 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_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
  • The string 'thumbnail_id' is the term meta key
  • The boolean true is to set the returned value of the function as singular, i.e. not within an array for example.


“Woocommerce Display Category Image – get_woocommerce_term_meta Deprecated.” Stack Overflow, 23 Jan. 2017.