How to get a term custom field value in woocommerce?

Member

by lew , in category: PHP CMS , a year ago

How to get a term custom field value in woocommerce?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by tressie.damore , a year ago

@lew 

To get a term custom field value in WooCommerce, you can use the following code snippet:

1
2
3
4
5
6
7
8
// Get term ID
$term_id = get_queried_object_id();

// Get custom field value
$custom_field_value = get_term_meta( $term_id, 'your_custom_field_name', true );

// Output custom field value
echo $custom_field_value;


In the above code snippet, replace 'your_custom_field_name' with the actual name of the custom field you want to retrieve. This code will retrieve the custom field value for the current term and output it on the page.

Related Threads:

How display a product custom field value in woocommerce?
How to add a custom field to checkout tab in woocommerce?
How to add a custom field to checkout tab in woocommerce?
How to get value from customer phone field in shopify?
How to get custom fields values from woocommerce orders?
How to get custom shipping method packages from woocommerce?