Skip to main content
replaced http://craftcms.stackexchange.com/ with https://craftcms.stackexchange.com/
Source Link

I'm trying to set the value of a custom field on an order when saving an entry. I found an example of how to do thisan example of how to do this for a simple text field, but the field I'm trying to set is an entries field, not just a text field. I've attempted to set the value using the following code in my entries.saveEntry event. I'm assuming I'm doing this wrong since this is an entries field, not a simple text field, but I don't know the syntax for setting content on an entries field.

$cart = craft()->commerce_cart->getCart();
$cart->setContentFromPost(['entriesFieldHandle' => $entry->id]);

I'm trying to set the value of a custom field on an order when saving an entry. I found an example of how to do this for a simple text field, but the field I'm trying to set is an entries field, not just a text field. I've attempted to set the value using the following code in my entries.saveEntry event. I'm assuming I'm doing this wrong since this is an entries field, not a simple text field, but I don't know the syntax for setting content on an entries field.

$cart = craft()->commerce_cart->getCart();
$cart->setContentFromPost(['entriesFieldHandle' => $entry->id]);

I'm trying to set the value of a custom field on an order when saving an entry. I found an example of how to do this for a simple text field, but the field I'm trying to set is an entries field, not just a text field. I've attempted to set the value using the following code in my entries.saveEntry event. I'm assuming I'm doing this wrong since this is an entries field, not a simple text field, but I don't know the syntax for setting content on an entries field.

$cart = craft()->commerce_cart->getCart();
$cart->setContentFromPost(['entriesFieldHandle' => $entry->id]);
edited title
Link
jthomas
  • 373
  • 1
  • 8

How do I set the value of a custom entries order field on from a plugin?

Source Link
jthomas
  • 373
  • 1
  • 8

How do I set the value of a custom entries order field on from a plugin?

I'm trying to set the value of a custom field on an order when saving an entry. I found an example of how to do this for a simple text field, but the field I'm trying to set is an entries field, not just a text field. I've attempted to set the value using the following code in my entries.saveEntry event. I'm assuming I'm doing this wrong since this is an entries field, not a simple text field, but I don't know the syntax for setting content on an entries field.

$cart = craft()->commerce_cart->getCart();
$cart->setContentFromPost(['entriesFieldHandle' => $entry->id]);