Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { "rules_create_product_on_node_save" : {
- "LABEL" : "Create product on node save",
- "PLUGIN" : "reaction rule",
- "REQUIRES" : [ "rules" ],
- "ON" : [ "node_insert" ],
- "IF" : [
- { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "example" : "example" } } } },
- { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_product_reference" } }
- ],
- "DO" : [
- { "entity_create" : {
- "USING" : {
- "type" : "commerce_product",
- "param_sku" : "[node:title]",
- "param_type" : "product",
- "param_title" : "[node:title]",
- "param_creator" : [ "node:author" ],
- "param_commerce_price" : { "value" : { "amount" : "0", "currency_code" : "USD" } },
- "param_commerce_stock" : "0"
- },
- "PROVIDE" : { "entity_created" : { "created_product" : "Created Product" } }
- }
- },
- { "entity_save" : { "data" : [ "created-product" ], "immediate" : 1 } },
- { "data_set" : {
- "data" : [ "node:field-product-reference" ],
- "value" : [ "created-product" ]
- }
- }
- ]
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement