woocommerce_before_(object_type)_object_save
Trigger action before saving to the DB. Allows you to adjust object props before save.
Использование
add_action( 'woocommerce_before_(object_type)_object_save', 'wp_kama_woocommerce_before_object_type_save_action', 10, 2 );
/**
* Function for `woocommerce_before_(object_type)_object_save` action-hook.
*
* @param WC_Data $that The object being saved.
* @param WC_Data_Store_WP $data_store THe data store persisting the data.
*
* @return void
*/
function wp_kama_woocommerce_before_object_type_save_action( $that, $data_store ){
// action...
}
- $that(WC_Data)
- The object being saved.
- $data_store(WC_Data_Store_WP)
- THe data store persisting the data.
Где вызывается хук
woocommerce_before_(object_type)_object_save
woocommerce_before_(object_type)_object_save
woocommerce_before_(object_type)_object_save
woocommerce_before_(object_type)_object_save
woocommerce/includes/class-wc-shipping-zone.php 273
do_action( 'woocommerce_before_' . $this->object_type . '_object_save', $this, $this->data_store );
woocommerce/includes/abstracts/abstract-wc-product.php 1548
do_action( 'woocommerce_before_' . $this->object_type . '_object_save', $this, $this->data_store );
woocommerce/includes/abstracts/abstract-wc-data.php 295
do_action( 'woocommerce_before_' . $this->object_type . '_object_save', $this, $this->data_store );
woocommerce/includes/abstracts/abstract-wc-order.php 221
do_action( 'woocommerce_before_' . $this->object_type . '_object_save', $this, $this->data_store );
Где используется хук в WooCommerce
woocommerce/src/Internal/Caches/OrdersVersionStringInvalidator.php 61
add_action( 'woocommerce_before_order_object_save', array( $this, 'handle_before_order_save' ), 10, 1 );