【发布时间】:2021-06-22 20:29:15
【问题描述】:
我有一个在 WooCommerce 中创建产品的 ERP 系统,我需要它们是私有的而不是公开的。
我尝试了钩子woocommerce_rest_insert_product,但它什么也没做。我尝试使用plugins_loaded 操作将其添加到插件和 mu-plugin 上。
我在 WC_REST_Products_V1_Controller 类中找到了钩子,理论上它应该可以工作...
/**
* Fires after a single item is created or updated via the REST API.
*
* @param WP_Post $post Post data.
* @param WP_REST_Request $request Request object.
* @param boolean $creating True when creating item, false when updating.
*/
do_action( 'woocommerce_rest_insert_product', $post, $request, false );
【问题讨论】:
标签: php wordpress woocommerce hook-woocommerce woocommerce-rest-api