Skip to content

Commit

Permalink
gspc-add-entry-data-to-woo-order-custom-field.php: Fixed PHPCS issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
spivurno committed Sep 25, 2024
1 parent 5d3735f commit da70c04
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
* 1. Install per https://gravitywiz.com/documentation/how-do-i-install-a-snippet/
* 2. Configure the snippet based on inline instructions.
*/
add_action( 'woocommerce_checkout_create_order_line_item', function ( $item, $cart_item_key, $values, $order ) {
add_action( 'woocommerce_checkout_create_order_line_item', function ( $item, $cart_item_key, $values, $order ) {

$entry_ids = $item->get_meta( 'gspc_gf_entry_ids', true );
if( $entry_ids ){

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 );

0 comments on commit da70c04

Please sign in to comment.