WooCommerce product page doesn’t have styling or CSS

Problem:

WooCommerce product page doesn't have styling or a theme.This weekend I was expanding an existing WordPress website with WooCommerce web store to include support for subscriptions.

To do this, I was using WooCommerce Subscriptions. Installing and setting up the plugin, an extension for WooCommerce, was easy and done within a few hours.

However, I spent a long time dealing with the problem that the WooCommerce product page was displayed without styling or formatting. I also only saw the product information and no header or footer. No theme files were loaded.

When I looked at the source code, I also did not see the standard WordPress HTML mark-up code. The other WooCommerce pages such as product overview, shopping cart and the my shop environment did work correctly.

Solution:

This WordPress website was not originally developed by me but by another company. I did install WooCommerce. A custom theme was created for the website in the past with quite a bit of PHP code. So I started looking at the code and doing some internet research.

In your situation, also check if you have the latest updates installed and if there are any errors in the error log. In my situation, I had no updates and no errors either.

The solution for the product page turned out to be this code:

You place this in the functions.php file of the theme. The code indicates that the theme has support for WooCommerce.

function setup_woocommerce_support() {
    add_theme_support('woocommerce');
}
add_action( 'after_setup_theme', 'setup_woocommerce_support' );

Ultimate Member for masking content not logged in visitors:

Looking for a free plugin that requires visistors to login to see content? Then Ultimate Member is definitely worth a try. This plugin offers a personalized environment for users, login and registration page. In addition, you can specify per page or post whether this requires you to be logged in with a certain role.

> View more blogs about WooCommerce webwinkels

Getest op:

WordPress 6.5.5 met WooCommerce 9.0.2

Laat een reactie achter

Your email address will not be published. Required fields are marked *

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.