• Dear all,
    I want to create a page that displaying all list (list type) woocommerce categorie link, not thumbnail.
    Please help me. Thank you.

Viewing 1 replies (of 1 total)
  • One way to do this is to create your own shortcode and add the following to your child theme’s functions.php:

    
    add_shortcode('custom_create_category_list', 'custom_create_category_list_fxn');
    function custom_create_category_list_fxn() {
      $args = array(
      'orderby'  => 'name',
      'order'    => 'asc',
      'hide_empty' => 1  // Change this to 0 to show empty categories.
       );
      
       $product_categories = get_terms( 'product_cat', $args );
      
       if(!empty($product_categories)){
       echo '<ul>';
         foreach ($product_categories as $key => $category) {
            echo '<li>';
            echo '<a href="'.get_term_link($category).'" >';
            echo $category->name;
            echo '</a>';
            echo '</li>';
          }
       echo '</ul>';
       }
    }
    

    Then, on the page where you want the list to appear, you’d add the following in a Shortcode Block:

    
    [custom_create_category_list]
    

    You didn’t mention if you only needed this to handle top-level categories or subcategories, too. This code just handles top-level categories.

Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce category list in one page’ is closed to new replies.