i can add post field groups to orders post type, but, that just places a group of fields on the orders page, but, not related to the items in the order
Exactly, this is how Custom Fields behave generally in WordPress.
You will need to add options on your own to the fields.
This can be done manually by populating the fields in Toolset > Custom Fields, or, it can be done with the API wpt_field_options().
But this is an unofficial API that is not documented and we cannot assist it.
The filter wpt_field_options can be used to manipulate the options of select and radio field.
Arguments:
- $current_options
- $title (the title of the field)
Output: Array
Required format:
array(
array(
'#title' => 'First Title',
'#value' => 'first-value'
),
array(
'#title' => 'Second Title',
'#value' => 'second-value'
),
)
Example of usage:
Let's assume your theme has a colorset of dark, light and accent color, which are editable in the theme options. The theme stores these values as a wp_option theme_name_colorset in this format:
array(
'Dark' => '#333333',
'Light' => '#eeeeee',
'Accent Color' => '#ff3300'
)
You want to use these colors on a custom select field to define the headline color of the post. So we create a post field group with a select field: See Screenshot
Now we adding this function to our themes functions.php:
add_filter( 'wpt_field_options', function ( $current_options, $title_of_field ) {
if ( $title_of_field != 'Headline Color' ) {
// not our "Headline Color" field
return $current_options;
}
$theme_colorset = get_option( 'theme_name_colorset' );
if ( ! $theme_colorset ) {
// no theme colors are set yet
return array(
array(
'#title' => 'No colors available',
'#value' => 0
)
);
}
$new_options = array();
foreach ( $theme_colorset as $color_title => $color_value ) {
$new_options[] = array(
'#title' => $color_title . ' (' . $color_value . ')',
'#value' => $color_value
);
}
return $new_options;
}, 10, 2 );
As said we cannot assist this and it's not documented, maybe if you require more help with this you can find assistance by the contractors:
https://toolset.com/contractors/