From 4e263beae0ce4e75aec5f8850faf6c99d282063a Mon Sep 17 00:00:00 2001 From: matty0501 <17788098+matty0501@users.noreply.github.com> Date: Fri, 27 Sep 2024 08:33:53 +0100 Subject: [PATCH] `gspc-add-entry-data-to-woo-order-custom-field.php`: Added new snippet. (#894) * `gspc-add-entry-data-to-woo-order-custom-field.php`: Added new snippet. * `gspc-add-entry-data-to-woo-order-custom-field.php`: Fixed PHPCS issues. --------- Co-authored-by: David Smith --- ...d-entry-data-to-woo-order-custom-field.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 gs-product-configurator/gspc-add-entry-data-to-woo-order-custom-field.php diff --git a/gs-product-configurator/gspc-add-entry-data-to-woo-order-custom-field.php b/gs-product-configurator/gspc-add-entry-data-to-woo-order-custom-field.php new file mode 100644 index 00000000..f75b918d --- /dev/null +++ b/gs-product-configurator/gspc-add-entry-data-to-woo-order-custom-field.php @@ -0,0 +1,29 @@ +get_meta( 'gspc_gf_entry_ids', true ); + + if ( $entry_ids ) { + + $entry_id = $entry_ids[0]; + + $entry = GFAPI::get_entry( $entry_id ); + + $data = rgar( $entry, '4' ); // Replace 4 with the field ID you need + + $order->update_meta_data( '_my_custom_key', $data ); // Replace _my_custom_key with your custom meta key + + } + +}, 10, 4 );