use has_term for product attribute

Question

I’m using Conditional tags to display specific widget on specific product :
for example :

has_term(‘book’, ‘product_tag’)
or
has_term( array( ‘hyundai’, ‘kia’ ) , ‘pwb-brand’)

now i want use product attribute for conditional tags , for example display widget on products that has "color" attribute with "red" value :
something like this :

hast_term(‘red’ , ‘color’)

how can i do this ?
Thanks in advance

in progress 0
Milad Jafari 10 months 2020-12-04T13:10:29-05:00 1 Answer 11 views 0

Answer ( 1 )

    0
    2021-07-04T02:23:35-05:00

    I used this method for my site. ( attached picture )

    if ( has_term( ‘tehran’, ‘pa_city’ ) ) {
    echo ‘ something ‘;
    }


    Attachment

Leave an answer

Browse
Browse