Support

Account

Home Forums Add-ons Repeater Field Save value from update_sub_field Reply To: Save value from update_sub_field

  • Finally manage to solve it

    Putting the data there was more or less correct like

    update_post_meta( "$order_id", $field_rep, $row_no );
    update_sub_field(array($field_key_rep, $sub_no, $field_key_sub), $trackno, "$order_id");

    Think the main problem was when fetching the information and then doing it with the field names that would not work until the post was updated / saved. Using field_keys did on the other hand work.

    if (have_rows($field_key_rep, $postID)) {
    
    		$trackingNo = array();
    
    		// loop through the rows of data
    		while (have_rows($field_key_rep, $postID)):
    			the_row();
    
    			// Add to array
    			$trackingNo[] = get_sub_field($field_key_sub);
    
    		endwhile;
    }