Home » How to use WooCommerce product attributes in your metadata
How to use WooCommerce product attributes in your metadata

Overview

WooCommerce provides a way to utilize product attributes, including personalized ones, in your metadata to enhance search engine optimization (SEO). This documentation will guide you through two cases on how to include product attributes in your metadata effectively.

Product Attributes

Product attributes are custom categories. When you create a product attribute from your WP Admin under Products -> Attributes, it will create a new taxonomy with a name like 'pa_attribute_name'.

To add a product attribute, such as 'color', to your metadata, use the dynamic variable as shown below:

%%_ct_pa_color%%
Here,
  • 'ct' refers to Custom Taxonomy.
  • 'pa' stands for Product Attribute and 'color' is the attribute name.
To find your product attribute name, navigate to Products -> Attributes in your WordPress admin and look at the 'slug' column.

2. Custom Product Attributes

Custom product attributes in WooCommerce are stored as a post meta named '_product_attributes'.

This meta contains an array with attribute names as keys and their corresponding values.

To include custom product attributes in your metadata, use the dynamic variable as follows:
%%wc_product_attributes%%
To ensure this dynamic variable works as expected, add the provided filter to your theme's functions.php or child theme's functions.php file.
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list