B
B
BarneyGumble2020-07-15 00:17:46
WordPress
BarneyGumble, 2020-07-15 00:17:46

How to customize catalog page in WooCommerce?

I rarely work with WooCommerce. But the task arose - on the site in the existing template to customize the product catalog page, replacing the original layout with a pre-prepared one.

Half an hour of googling took me in the direction of hooks, actions and other muddy stuff scattered in different places. I was even surprised how confusing a seemingly simple task can be.

The question is, is there a simple option in which I could create one php file, embed the layout there and display the php layout in the right places like this? (conditional code)

<?php $products = $wpdb->query( "SELECT * FROM wc_products;" );?>

<?php get_header(); ?>

<div class="products">
<?php foreach($products as $product): ?>
    <div class="products__item">
        <h2><?=$product['title']?></h2>
        <p><?=$product['desc']?></p>
        <div><?=$product['price']?></div>
    </div>
<?php endforeach; ?>

<?php get_footer(); ?>


And then I would like to somehow use this file as the main template for displaying the category.

Is it possible to do so? And if so, how?

P.S.
A crutch option that goes against the logic of WP / WooCommerce is quite suitable for me

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jupiter Max, 2020-07-15
@vardoLP

in the active template, create a woocommerce folder, drop the necessary files or folders with files there and customize what you need in them. They connect themselves when loading the catalog

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question