When filtering the private metadata, we use the unset function to remove the private metadata from the response. However, this alters the final response format, changing it from an array of objects to a single object. For example:
Choose one product and set the channel visibility to "Sync & Show". Add some private metadata to the product (private metadata = metadata starting with _, for example _my_private_data).
Create some WC REST API credentials and do the following request GET wp-json/wc/v3/products/YOUR_PRODUCT_ID?gla_syncable=1
Without checking this PR, see how the metadata format is incorrect.
Changes proposed in this Pull Request:
Part of #2146
When filtering the private metadata, we use the unset function to remove the private metadata from the response. However, this alters the final response format, changing it from an array of objects to a single object. For example:
Incorrect:
Correct:
Screenshots:
Detailed test instructions:
_
, for example_my_private_data
).wp-json/wc/v3/products/YOUR_PRODUCT_ID?gla_syncable=1
Additional details:
Changelog entry