woocommerce_pre_delete_(object_type) filter-hookWC 8.1.0.

Filters whether an object deletion should take place. Equivalent to pre_delete_post.

Usage

add_filter( 'woocommerce_pre_delete_(object_type)', 'wp_kama_woocommerce_pre_delete_object_type_filter', 10, 3 );

/**
 * Function for `woocommerce_pre_delete_(object_type)` filter-hook.
 * 
 * @param mixed   $check        Whether to go ahead with deletion.
 * @param WC_Data $that         The data object being deleted.
 * @param bool    $force_delete Whether to bypass the trash.
 *
 * @return mixed
 */
function wp_kama_woocommerce_pre_delete_object_type_filter( $check, $that, $force_delete ){

	// filter...
	return $check;
}
$check(mixed)
Whether to go ahead with deletion.
$that(WC_Data)
The data object being deleted.
$force_delete(true|false)
Whether to bypass the trash.

Changelog

Since 8.1.0. Introduced.

Where the hook is called

WC_Data::delete()
woocommerce_pre_delete_(object_type)
woocommerce/includes/abstracts/abstract-wc-data.php 266
$check = apply_filters( "woocommerce_pre_delete_$this->object_type", null, $this, $force_delete );

Where the hook is used in WooCommerce

Usage not found.