Schema markup for product categories and subcategories – how to?

I’ve been wondering about which Schema should I use for an e-commerce site of one of my clients’ website. Can’t show proper code and sensitive information, but I’ll try to explain what I’ve been thinking about.

Right here: https://inchoo.net/online-marketing/schema-markup-for-ecommerce-websites/

The author says that for category pages I should use ItemList Schema

<script type="application/ld+json">  {  "@context":"http://schema.org",  "@type":"ItemList",  "ItemListElement":  [    {   "@type":"ListItem",    "position":0,    "url":"https://www.example.com/ankle-boots-ana.html"   },    {    "@type":"ListItem",    "position":1,    "url":"https://www.example.com/ankle-boots-clara.html"    },    {    "@type":"ListItem",    "position":2,    "url":"https://www.example.com/ankle-boots-maria.html"    }   ]  } </script> 

Does anyone have an example of how it would look? For example, if I have a category with electric guitars with 5 subcategories that contain certain electric guitar models which would be listed in the schema ListItem. Is that the best schema type for this instance?

Second question – when it comes to subcategories, should I use ItemList Schema?

<script type="application/ld+json"> {     "@context": "http://schema.org",     "@type": "ItemList",     "url": "https://www.myexamplestore.com/products/",     "numberOfItems": "2",     "itemListElement": [           {             "@type": "ListItem",             "position": 1,             "item": {               "@type": "Product",                   "image": "https://www.myexamplestore.com/product-one/image.jpg",                   "url": "https://www.myexamplestore.com/products/#productone",                   "name": "Product One",                   "offers": {                       "@type": "Offer",                       "price": "13.00",                       "priceCurrency": "USD",                       "url": "https://www.myexamplestore.com/products/"                   }             }           },           {             "@type": "ListItem",             "position": 2,             "item": {               "@type": "Product",                   "image": "https://www.myexamplestore.com/product-two/image.jpg",                   "url": "https://www.myexamplestore.com/products/#producttwo",                   "name": "Product Two",                   "offers": {                       "@type": "Offer",                       "price": "12.00",                       "priceCurrency": "USD",                       "url": "https://www.myexamplestore.com/products/"                   }               }           }     ] } </script> 

I know that it’s a bit of a gray area for Google when it comes to adding product information on category pages – does that apply also for the subcategory pages?

I would be so thankful for Your help and guidance <3 Cheers

WP Query | search by sub-categories

I have a small problem with the functioning of a search bar that gives the user the possibility to find professionals based on their job categories.

I explain: I am talking about a portal that allows the user to be able to carry out a search as written above.

How I managed the programming: if it is a portal where there are professionals, I created the custom post type: Pro

To specify the services that these professionals are able to perform, I created a plugin that allows me by specifying in the array which custom post types to grant the possibility to implement taxonomies:

register_taxonomy( 'categoria', array( 'pro' ), $  args ); 

now very simply I have implemented a form on a page:

<div id="search_video"  class="container-fluid">     <div style="text-align: center;background-color: #fff;" class="col-md-12">         <form name="NOME_FORM" method="get" id="advanced-searchform" role="search" action="<?php echo esc_url( home_url( '/results' ) ); ?>">             <div class="input-group mb-3">                 <div class="input-group-prepend">                     <span class="input-group-text"><i class="fa fa-search"></i></span>                 </div>                 <input type="text" id="art" name="art" class="form-control">             </div>         </form>     </div>     </div> </div> 

pointing to the results page.

to display the results I used this query:

<?php $  art_p = $  _GET['art'];         $  query_v = array(             'post_type' => array('pro'),             'posts_per_page'    => -1,             'orderby' => 'meta_value',             'order' => 'ASC',             'tax_query' => array(                 array(                     'taxonomy' => 'categoria',                     'terms' => $  art_p,                 )             )         );         $  res_v = new WP_Query( $  query_v );         ?> 

now the problem:

I have implemented two test professional profiles, in the services category, I have specified as a sub-category of services for professional A:

  • creation of websites

and for professional B:

  • logo creation

but if I look in the website creation bar: it gives me both professionals as a result and this is not good.

So my question is how can I filter the results so that the user search is based on the sub-category of services and only brings out the professionals who own that sub-category, what did I do wrong with my query?

How to target all woocommerce categories that don’t have any subcategories in them?

I want to target all pages (product categories) that are displaying the products themselves.

My woocommerce settings set to show only categories/subcategories (unless there are none) and then by default the products grid is displayed on the page.

is_product_category() function doesn’t help since it also targets the parent categories which don’t have direct products in them.

Most of my categories that don’t any subcategories in them are grandchildren categories if it matters for the answer.

How can I achieve it and to use it in woocommerce hooks?

Show subcategories broken when WP/WC updates

I’ve been given to mantain a site who wasn’t updated for a while: it had WP 4.9.15 and WooCommerce 2.6.14

Now I’ve made a site test where i’ve updated all these things and now i have WP 5.4.2 and WC 4.3.1

One thing that is broken and i’m not able to figure why is the page showing the products by category: they have a 3 level category tree. It worked this way: if the category asked was a leaf, the page showed the product list. If it wasn’t a leaf, it showed all the subcategories.

The template page doing this is archive-product.php which has this simple loop to show everything:

            <h1 class="page-title"><?php woocommerce_page_title(); ?></h1>              <?php if ( have_posts() ) : ?>                  <?php                     /**                      * woocommerce_before_shop_loop hook                      *                      * @hooked woocommerce_result_count - 20                      * @hooked woocommerce_catalog_ordering - 30                      */                     do_action( 'woocommerce_before_shop_loop' );                 ?>                  <?php woocommerce_product_loop_start(); ?>                      <?php woocommerce_product_subcategories(); ?>                      <?php while ( have_posts() ) : the_post(); ?>                          <?php wc_get_template_part( 'content', 'product' ); ?>                      <?php endwhile; // end of the loop. ?>                  <?php woocommerce_product_loop_end(); ?>                  <?php                     /**                      * woocommerce_after_shop_loop hook                      *                      * @hooked woocommerce_pagination - 10                      */                     do_action( 'woocommerce_after_shop_loop' );                 ?>              <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>                  <?php wc_get_template( 'loop/no-products-found.php' ); ?>              <?php endif; ?> 

Now this page works only if the category requested is a leaf thus it has to display a list of products. If the category requested is not a leaf, no subcategory is shown and the page is blank with only the category name (page_title) showing. So it means that the query is somewhat did good, but why no category is shown? Thank you if you can help me solving this trouble

WooCommerece REST API Api not showing all subcategories by parent

I’m requesting to the following endpoint

wp-json/wc/v3/categories?parent=someID

and getting a response for the first 2 children my problem those children has also children (deeply nested here of categories as showing on the image below ), I need to show all subcategories under a specific parent os how I can do this? enter image description here

Help with not displaying other subcategories

In the php web video script that I’m using, in the Upload Form, a User can choose which category to upload to. The Form also has a sub-category field to choose from. (Admin sets the subcategories, under a category).

Upon testing (after adding a subcategory called “trees” under Category A) on the Upload Form I see Category A and have two choices for subcategories “None” and “trees”.

But If I change my mind and decide, while the Upload Form is open, to upload to Category B, I still see the…

Help with not displaying other subcategories

ios Safari – Magento 2.2.2 Responsive Menu Subcategories not Expanding

ios Safari – Magento 2.2.3 Responsive Menu Subcategories not Expanding.

Hello,

We’re finding an issue that occurs with iphone and tablets using Safari. It as a high occurrence rate:

Steps> 1. Visit webpage 2. Tap on Responsive Menu 3. Responsive Menu Opens 4. Tap on Category (expected result: subcategories expand beneath) 5. Sub categories do not expand

Getting Subcategories even if product count for each is 0

In my module, I am getting the current ID and then using the category repository and the “getChildren” method. This works great, except it doesn’t return child categories with product counts of 0.

How would I get around this?

“getAllChildren” seemed promising, but returned all descendants, whereas I’m just looking for the immediate children, regardless of product counts.

How to organize categories and subcategories of products in menus?

I have product content type that I want to display in a menu. Every product belongs to subcategory that belongs to main category, for example:

Computers:    PC:       - product 1       - product 2       - product 3    Laptop:       - product 1       - product 2       - product 3    Tablets:       - product 1       - product 2       - product 3  Phones:    Android:       - product 1       - product 2       - product 3    iOS:       - product 1       - product 2       - product 3 

When clicking on products item in main menu, I need to display a horizontal menu with main categories (Computers, Phones) and a vertical menu with subcategories (PC, Laptop, Tablets). Computers > PC should be the default selection. Whenever any category/subcategory is selected it should display a list of links to the product page.

What are the most common modules use to do something like this? Are there any tutorials or basic steps I can take to accomplish this goal?