Case 1: product attributes
Product attributes are custom taxonomies. Each time you create a product attribute from your WP Admin, Products, Attributes, it will create a new taxonomy like this:
“pa” means product attributes.
To add product attributes to your metadata (eg: title), enter this dynamic variable like this:
To find your product attribute name, go to Products, Attributes and look at the slug column.
Case 2: custom product attributes
Custom product attributes are saved as a post meta called “_product_attributes”.
It’s an array containing the names (keys) and values of your product attributes.
Use this dynamic variable in your metadata:
Then add this filter to your functions.php file of your theme / child theme: