• Resolved toddi2303

    (@toddi2303)


    When I created new checkout fields I wonder if those are part of the woocommerce get-orders API and where I can find them.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Bartek

    (@bartj)

    Hi @toddi2303!

    Checkout fields are saved as an order meta values, so any $order->get_meta('_<field_name>') should be able to retrieve custom values (mind the underscore at the beginning of the field name).

    Alternatively, there’s a class \WPDesk\FCF\Free\Integration\Integrator in our codebase, which provides an API to access fields and its values in specified order. To make use of this class, you need to hook into flexible_checkout_fields/init.

    Here’s an example for getting order field value:

    add_action(
      'flexible_checkout_fields/init',
      static function ( $integrator ) {
        // Get value of custom field for order #13.
        $field = $integrator->get_field_value( 'custom_field', 13 );
        // ...
      }
    );
    Thread Starter toddi2303

    (@toddi2303)

    Thanks Bartek,

    I meant how to get the mate data via the REST API and not inside WP. Might be that I found it in the meta data properties section. When I can believe the API documentation the meta fields will be listed there. Unfortunately I could not find it before I wrote this post.

    Thanks anyways

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Order API checkout fields’ is closed to new replies.