Website Building » WooCommerce » How Do I Change the Schema in WooCommerce?

How Do I Change the Schema in WooCommerce?

Last updated on January 21, 2023 @ 12:31 pm

If you’re running a WooCommerce store, you’ve probably noticed that the default WooCommerce schema doesn’t include some important details. For example, WooCommerce doesn’t specify the currency for prices, nor does it provide detailed information about products and product variations. This can make it difficult for search engines to understand your content, and may result in lower ranking in search results.

Fortunately, it’s easy to change the schema in WooCommerce. You can do this by editing the WooCommerce code or by using a plugin.

If you want to edit the WooCommerce code, you’ll need to access your site’s files via FTP. Once you’ve connected to your site via FTP, navigate to the /wp-content/plugins/woocommerce/templates/ folder. In this folder, you’ll find a file called single-product.php.

Open this file in a text editor and look for the following line of code:

$schema = 'http://schema.org/Product';

Replace this line with the following:

$schema = 'http://schema.org/Offer';

Save your changes and upload the file back to your server. This will change the schema for all products on your site.

If you want more control over which products use which schema, or if you want to avoid editing WooCommerce code, you can use a plugin like WP SEO Structured Data Schema. This plugin lets you choose which schema to use for each product on your site. It also provides other features like automatic tagging of products with relevant schema types (e.g., “New Arrivals” or “Sale Items”), and the ability to add custom fields for even more control over your structured data.

Changing the schema in WooCommerce is easy and can be done with just a few clicks. By changing the default WooCommerce schema to something more specific, like Offer, you can help search engines better understand your content and improve your ranking in search results.

PRO TIP: If you are considering changing the schema in WooCommerce, it is important to note that this is a complex process that should only be undertaken by experienced developers. There are many potential risks associated with changing the schema, including data loss and database instability. Before proceeding, please backup your database and ensure that you have a thorough understanding of the schema and how it works.

Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.