[Enhancement] Create new filter `wc_lock_sku_query` for SKU lock query. (#49755)
Create a new filter wc_lock_sku_query to allow third party to filter the SKU lock query. Fixes #49660 * Create new filter wc_lock_sku_query. * Bail early with filter prop @coreymckrill Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com> * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
b01aabef29
commit
47e4d918c9
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: enhancement
|
||||
|
||||
Add a filter to override the SKU database lock.
|
|
@ -131,6 +131,20 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
|||
$sku,
|
||||
$sku
|
||||
);
|
||||
|
||||
/**
|
||||
* Filter to bail early on the SKU lock query.
|
||||
*
|
||||
* @since 9.3.0
|
||||
*
|
||||
* @param bool|null $locked Set to a boolean value to short-circuit the SKU lock query.
|
||||
* @param WC_Product $product The product being created.
|
||||
*/
|
||||
$locked = apply_filters( 'wc_product_pre_lock_on_sku', null, $product );
|
||||
if ( ! is_null( $locked ) ) {
|
||||
return boolval( $locked );
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
|
||||
$result = $wpdb->query( $query );
|
||||
|
||||
|
|
Loading…
Reference in New Issue