Display list of categories that contain products with a specific tag

There’s probably a few ways to do this. The key will be cutting down on the number of loops you need to make it more efficient. I think this will work: $query = new WP_Query( array( ‘post_type’ => ‘product’, ‘posts_per_page’ => ‘-1’, // unlimited posts ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_tag’, ‘field’ => ‘slug’, … Read more

Problem with cURL and rest API

The curl_init function accepts an url and what you are passing there looks like a command line call. Please check this link for an example of passing username and password through php curl functionality. Basically you have to use just http://localhost/wp-json/wc/v1/products in curl_init and set username using curl_setopt function with CURLOPT_USERPWD parameter. Example: $ch = … Read more

how to use different page design for different category

For overriding default templates please check this. If you want different/custom category template for specific category then you may create a php file which has naming structure like taxonomy-product_cat-{slug}.php. For example, to create custom category template for clothing category, you will need to create taxonomy-product_cat-clothing.php where clothing is slug of the category. Place this file … Read more