Change Wordpress Woocommerce Category Page

Asked

Viewed 781 times

-2

Good evening guys All right ?

I have a small doubt, I would like to adjust my page listing category products equal to my home of this my site http://enproductos.com.br/ Obs: I made a Shortcode in Function.php that makes list like this 'title', 'value' inf1' and 'inf2', I would like my category page that lists the products according to the category that the user selects stay in the same mode, I can’t find the file for me to edit and I don’t know where to start

  • To customize the templates you can copy the directory templates from Woocommerce, to your theme by changing the name to woocommerce. This way your theme files will be considered. It is necessary to copy only the files that will be changed. Example: Copy: wp-content/plugins/woocommerce/templates/archive-product.php for wp-content/themes/TEMA/woocommerce/archive-product.php Speaking specifically of the categories page, the files you should consider are the archive-product.php and also those contained in the directory loop.

  • Thanks for the help I understood the functioning, I made a customization as per the request of my client big hugs and I hope I can reassign you some day with knowledge

  • I was able to solve according to the code below, but also wanted to know how I can list only the selected category

1 answer

-1

I managed to solve my problem, my code was as follows, within my theme theme/Woocommerce/Archive-product.php

                    <div class="wc-products">
                        <ul class="products">
                            <?php
                                $args = array( 'post_type' => 'product', 'posts_per_page' => 1, 'product-category' => 'shoes', 'orderby' => 'rand' );
                                $loop = new WP_Query( $args );
                                while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>

                                    <h2>Shoes</h2>

                                        <li class="product">    

                                            <a href="<?php echo get_permalink( $loop->post->ID ) ?>" title="<?php echo esc_attr($loop->post->post_title ? $loop->post->post_title : $loop->post->ID); ?>">

                                                <?php woocommerce_show_product_sale_flash( $post, $product ); ?>

                                                <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="300px" height="300px" />'; ?>

                                                <h3><?php the_title(); ?></h3>

                                                <span class="price"><?php echo $product->get_price_html(); ?></span>                    

                                            </a>

                                            <?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?>

                                        </li>

                            <?php endwhile; ?>
                        <?php wp_reset_query(); ?>
                    </ul><!--/.products-->
                </div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.