I am using the WooCommerce Product Sync plugin, and I am working with the following two filters to modify product data during synchronization:
- /
wps_product_fields
– This filter is triggered on the "parent" site when a product is updated. It builds an array of WooCommerce product data, and I am adding extra fields to this array for use on the receiving site.woocommerce_rest_pre_insert_product_object
– This filter is triggered on the receiving site when it receives product data.
I am using Xdebug for debugging, and breakpoints work fine when I trigger the wps_product_fields
filter on the parent site. However, when I set breakpoints inside the woocommerce_rest_pre_insert_product_object
filter on the receiving site, Xdebug does not seem to detect anything running.
I suspect this is happening because the WooCommerce Product Sync plugin processes data in the background. It's switching to the receiving site, picking up the incoming data and processing, but XDEBUG can't seem to see that.
What I’ve Tried:
Ensuring Xdebug is properly configured and breakpoints are working in other parts of the code.
Attempting to manually log data to confirm the hook is running. On run, I have it updating my product title just as a means to keep checking if it changes or not.
Question:
How can I get Xdebug breakpoints to trigger when the woocommerce_rest_pre_insert_product_object
filter runs, given that the plugin works in the background? (I think).
Any insights on debugging background processes in WooCommerce with Xdebug would be appreciated.