This guide will show you how to update an attribute value for a given product relation using the CSV product importer.
Let’s imagine that we have a product (name (sku)) “Vintage Cassete Player (vintageA)” and that this product have two product relations with attributes and, under each of these relations, two related products:
Relation: “Customer Also Bought”
Product: “Vintage Vinyl Player (vintageB)”
Product: “Vintage CD Player (vintageC)”
Relation: “Recommended”
Product: “Retro Gaming Console (retroA)”
Product: “Retro Jukebox (retroB)”
Attribute: “Call to Action (text)”
Attribute: “Golden Tags (multiselect) (select values: Pro, Tech, Hype, Hot, Avant-garde)”
To update each attribute value of each product under each relation type we will need 5 columns in our CSV. One column header is “SKU” which will have the value of the product that have the relations we are working with, in our example it will be “vintageA”, the sku of “Vintage Cassete Player”. The other four columns headers are going to be written in the following pattern:
Relation Attribute:{Relation Type Name}:{Attribute Name}
“Relation Attribute”: This indicates to the importer that this column will update the attribute values of a product relation.
“{Relation Type Name}”: Change this with the name of the target relation type, for instance “Customer Also Bought”.
“{Attribute Name}”: Change this with the name of the target attribute, for instance “Golden Tags”
So for our example, here are the other 4 columns headers we need:
Relation Attribute:Customer Also Bought:Call to Action
Relation Attribute:Customer Also Bought:Golden Tags
Relation Attribute:Recommended:Call to Action
Relation Attribute:Recommended:Golden Tags
Don’t forget the “:” and to write correctly the relation type name and the attribute name, both case sensitive.
Each entry in these special columns needs to be written with this pattern:
{Product SKU} ({Attribute Value}) || {Product SKU} ({Attribute Value}) || …(repeat if necessary)
“{Product SKU}”: the sku of the related product that will receive the attribute values.
“{Attribute Value}”: set between “()”, the attribute value that will be set. For text attributes it’s the text itself, for mutilselect attributes you have to separate each value with a “,”. Like, in our example, for “Golden Tags” we could write “(Hot, Tech, Avant-garde)”.
“||”: separate each related product with “||” if necessary
Let’s see how we have each entry in our CSV to better illustrate this:
Relation Attribute:Customer Also Bought:Call to Action
vintageB (Buy now!) || vintageC (Click to be happy)
Relation Attribute:Customer Also Bought:Golden Tags
vintageB (Hot, Hype) || vintageC (Avant-garde)
Relation Attribute:Recommended:Call to Action
retroA (Find out why!) || retroB (You should be dancin` yeah!)
Relation Attribute:Recommended:Golden Tags
retroA (Hot, Tech) || retroB (Pro, Hot, Avant-garde, Hype)
If you don’t want to set an attribute value for a given related product under a given relation type just leave that one out. For instance, if you don’t want to update the attribute value for “retroB” under “Relation Attribute:Recommended:Golden Tags” then your entry can be just “retroA (Hot, Tech)”.
How our final CSV file will look like:
Now you just have to import this file into “Import/Export > CSV Importers > Products” and voilà!