WooCommerce: Redacting or hiding customer data in WooCommerce API requests

When apps like Metorik connect to your WooCommerce site over the WooCommerce API, we get all customer and order data.

If you'd like to prevent Metorik (and even other apps) from accessing this data, we currently recommend that you use this code or similar to filter the API responses and redact the data. When Metorik talks to your site, it will just store all customer name, address, email, etc. data as REDACTED.

You should add this code to your site using a Code Snippets plugin or similar: https://gist.github.com/bryceadams/faf96cde20c2fe63b4cb580f1bafa901.

  1. You should change site.test in the 3 methods to be your domain eg. store.com.
  2. You can change the $onlyMetorikRequests variable to be false if you want to run the code on all WooCommerce API requests (this may break functionality on your site used by other apps/plugins, so do so with caution).

In the future we will turn this into a setting or filter that's built into the Metorik Helper plugin.

Still need help? Contact Us Contact Us