Skip to main content
Question

Value is being grouped under a single indexed item zapier


I'm 94% sure This is the initial issue; the values are all attached to the number one for some reason. So, every time I try to format the data instead of one output with 7 lines it returns all value data on the same line on 7 different outputs.

 

Metadata values are being grouped under a single indexed item 

 

Data is coming in from my website through this code: From Customizing Your Zaps - Knowledgebase

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

function tec_automator_attendee_custom_fields( $attendee_data, $attendee ) {

    $attendee_id = $attendee[ 'attendee_id' ];

    // Get the serialized array from the postmeta table

    $serialized_data = get_post_meta( $attendee_id, '_tec_tickets_commerce_attendee_fields', true );

    if ( empty( $serialized_data ) ) {

        return $attendee_data;

    }

    // Define custom fields to include

    $fields_to_include = [ 'field1', 'field2' ];

    $meta_fields       = [];

    // Loop through serialized data and extract selected fields

    foreach ( $serialized_data as $field_name => $field_value ) {

        foreach ( $fields_to_include as $label ) {

            if ( strpos( $field_name, $label ) !== false ) {

                $meta_fields[ $label ] = $field_value;

            }

        }

    }

    // Merge the selected fields into the attendee data

    $attendee_data[ 'attendee_metadata' ] = $meta_fields;   return $attendee_data;

}add_filter( 'tec_automator_map_attendee_details', 'tec_automator_attendee_custom_fields', 10, 2 );

I have tried:

Forcing $meta_fields to be a structured array of key-value pairs (structure it as an array of field objects)

Tried structuring it as a list of objects that explicitly group each field's name, ID, and value together.

Tried to flatten the data structure so each field is directly assigned to attendee_data

I'm sure it can be fixed either in code or through the formatter, but I don’t have the knowledge to do either

Followed  this step by step How To Parse Keys and Values From Line-Item Arrays Into Zapier Mappable Values | Zapier Community

 

The Custom value Names all split correctly into different outputs but the values do not. This has been a real headache, but I’m sure a more experienced zapper or coder could figure this out. Please Help!

 

I just want it mapped like this in order to continue onto other steps in this zap

 

 

 

 

 

 

 

 

 

 

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply