Att koppla en customer profile till en order

boho999's picture

Hej

Jag behöver skapa en ny order mha rules. Ordern behöver naturligtvis en customer profil på sig för att anget faktura adress. Allting skpas korrekt men profilen kopplas inte till ordern. Det är säkert något riktigt enkelt som jag förbisett men trots idogt letande på webben har jag inte funnit ngn lösning. Hur kopplas profilen med ordern?

Här är en export av en rule som jag testat med:

{ "rules_create_order_and_profile" : {
"LABEL" : "Create order and profile",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_cart", "commerce_checkout" ],
"IF" : [
{ "entity_has_field" : {
"entity" : [ "site:current-cart-order" ],
"field" : "commerce_customer_billing"
}
}
],
"DO" : [
{ "commerce_cart_product_add_by_sku" : {
"USING" : { "user" : "4", "sku" : "10001", "quantity" : "1", "combine" : "1" },
"PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
}
},
{ "entity_create" : {
"USING" : {
"type" : "commerce_customer_profile",
"param_type" : "billing",
"param_user" : "4"
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "site:current-cart-order:commerce-customer-billing" ],
"value" : [ "entity-created" ]
}
},
{ "data_set" : { "data" : [ "entity-created:uid" ], "value" : "4" } },
{ "data_set" : {
"data" : [ "entity-created:commerce-customer-address:name-line" ],
"value" : "Donald Duck"
}
},
{ "entity_save" : { "data" : [ "entity-created" ] } },
{ "commerce_checkout_complete" : { "commerce_order" : [ "site:current-cart-order" ] } }
]

Sweden

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week