最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to debug filter in WooCommerce Product Sync with Xdebug? - Stack Overflow

programmeradmin9浏览0评论

I am using the WooCommerce Product Sync plugin, and I am working with the following two filters to modify product data during synchronization:

  • /
  1. 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.

  2. 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.

发布评论

评论列表(0)

  1. 暂无评论