G
G
Genri_Rus2019-09-04 21:32:11
WooCommerce
Genri_Rus, 2019-09-04 21:32:11

How to disable categories?

There is a standard cycle for displaying posts (in this case, products)
In archive-product.php I display products

<?php do_action('woocommerce_before_main_content'); ?>
    
        <?php do_action('woocommerce_archive_description');?>
        
        <?php 
        
        $args = array(
          'post_type' => 'product',
          'posts_per_page' => 19,
        );
              
        global $wp_query;
        
        $wp_query = new WP_Query($args);
        
                
        if($wp_query->have_posts()) :
        ?>

        <?php woocommerce_product_loop_start(); ?>
          
          
          <?php while($wp_query->have_posts()) : $wp_query->the_post(); ?>

            <?php wc_get_template_part('content','product');?>
            
          <?php endwhile; ?>
          
        <?php woocommerce_product_loop_end();?>	
        
        <?php endif;?>
        
        
    <?php do_action('woocommerce_after_main_content');?>

In this case, products and categories are displayed, but how to display only products?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question