I’ve added additional Custom Fields to my WooCommerce pages – will these be included when downloading from WooCommerce?

The v2 REST API now returns additional Meta Data for most API endpoints including Customers, Orders, and Products. In our testing custom fields that were added to WooCommerce pages are included in the Meta Data for that endpoint (e.g. Orders). This screenshot shows the Meta Data for an Order which includes the shipping phone number field which was added as a custom field to the checkout page:

You can target individual Meta Data records by their key name if you wish to retrieve their value and populate another FileMaker field. For example if you wish to retrieve the value for the _shipping_phone Meta Data key shown in the above screenshot you can create a table occurrence named OrdersMetaDataShippingPhone and a relationship to Orders as follows:

You would then populate the zk_Utility_g field with the value of the key you wish to target - in this example "_shipping_phone" - and use this reference to get the value for the Shipping Phone number for the Order: 

OrdersMetaDataShippingPhone::Value

You could also use the ExecuteSQL function to retrieve a Meta Data key value without having to create relationships - this calculation will also return the value for the Shipping Phone number for the Order:

ExecuteSQL ( "SELECT " & GetSQLFieldName ( OrdersMetaData::Value ) & " FROM OrdersMetaData WHERE " & GetSQLFieldName ( OrdersMetaData::Key ) & " = ? AND " & GetSQLFieldName ( OrdersMetaData::_kf_OrderID ) & " = ?" ; "" ; "" ; "_shipping_phone" ; Orders::_kp_OrderID )

Still need help? Contact Us Contact Us