Julian Wagner
Julian Wagner

Reputation: 684

How to make changes to Woocommerce templates only for shop pages

The question has been asked here before, but I found all solutions insufficient for what I’m trying to achieve.

The usual answer is to overwrite archive-product.php in your theme. However if you do this, you also overwrite the design for category pages.

For example with product categories you can overwrite a specific product_category with product-cat-{slug}.php I wonder if there is a possible way to just overwrite the main shop page of Woocommerce.

Upvotes: 0

Views: 162

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253784

When overriding templates, to make changes only for specific product archive pages, you can use WooCommerce (or WordPress) conditional tags. So in your case you will use is_shop(), inside your template code, a bit like:

if ( is_shop() ) {
    // Here add your customized code for shop pages
} else {
    // Here you keep original template code (optional)
}

Related documentation:

Upvotes: 2

Related Questions