L
L
leviathan2017-08-28 03:18:25
WordPress
leviathan, 2017-08-28 03:18:25

How to check a product for a category or attribute?

I can't find it on google.
Help me please!
Tried "is_category()" and "is_product_category()" and no result...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WordPress WooCommerce, 2017-08-28
@maxxannik

the get_attributes and get_category_ids methods of the object https://docs.woocommerce.com/wc-apidocs/class-WC_P...
object can be obtained in different ways, the easiest way is by function $product = wc_get_product($product_id);
methods usually return arrays. well, it’s already easier to check this or that value in an array in Google)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question