I created a rule to be fired when a "New Commerce product is saved" Then I set a action to create a Product Display node and and another action to set the title for the Product Display to be the same as for the new commerce product. So far so good.
Now I need to create another action to set the field product of the Product display to be the same as the Commerce product SKU.
Here is the problem since I can not get this value. I tried to add a condition of the type "Entity has field" but it seems like the SKU vale is not a field at all.
How can I accomplish with this?
Code for the rule:
{ "rules_create_product_display" : {
"LABEL" : "Create Product Display",
"PLUGIN" : "reaction rule",
"TAGS" : [ "commerce" ],
"REQUIRES" : [ "rules", "entity" ],
"ON" : [ "commerce_product_insert" ],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "node",
"param_type" : "product_display",
"param_title" : "[commerce-product:title]",
"param_author" : [ "commerce-product:creator" ]
},
"PROVIDE" : { "entity_created" : { "product_display_created" : "Created Product Display" } }
}
},
{ "entity_save" : { "data" : [ "product-display-created" ], "immediate" : 1 } },
{ "redirect" : { "url" : [ "product-display-created:edit-url" ] } },
{ "drupal_message" : { "message" : "Product display created. You can edit it at: [product-display-created:nid]" } }
]
}
}