plugin updates

This commit is contained in:
Tony Volpe
2024-09-17 10:43:54 -04:00
parent 44b413346f
commit b7c8882c8c
1359 changed files with 58219 additions and 11364 deletions

View File

@@ -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 );
@@ -642,21 +656,21 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
// Fire actions to let 3rd parties know the stock is about to be changed.
if ( $product->is_type( 'variation' ) ) {
/**
* Action to signal that the value of 'stock_quantity' for a variation is about to change.
*
* @since 4.9
*
* @param int $product The variation whose stock is about to change.
*/
* Action to signal that the value of 'stock_quantity' for a variation is about to change.
*
* @param WC_Product $product The variation whose stock is about to change.
*
* @since 4.9
*/
do_action( 'woocommerce_variation_before_set_stock', $product );
} else {
/**
* Action to signal that the value of 'stock_quantity' for a product is about to change.
*
* @since 4.9
*
* @param int $product The product whose stock is about to change.
*/
* Action to signal that the value of 'stock_quantity' for a product is about to change.
*
* @param WC_Product $product The product whose stock is about to change.
*
* @since 4.9
*/
do_action( 'woocommerce_product_before_set_stock', $product );
}
break;
@@ -732,16 +746,48 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
if ( in_array( 'stock_quantity', $this->updated_props, true ) ) {
if ( $product->is_type( 'variation' ) ) {
/**
* Action to signal that the value of 'stock_quantity' for a variation has changed.
*
* @since 3.0
*
* @param WC_Product $product The variation whose stock has changed.
*/
do_action( 'woocommerce_variation_set_stock', $product );
} else {
/**
* Action to signal that the value of 'stock_quantity' for a product has changed.
*
* @since 3.0
*
* @param WC_Product $product The variation whose stock has changed.
*/
do_action( 'woocommerce_product_set_stock', $product );
}
}
if ( in_array( 'stock_status', $this->updated_props, true ) ) {
if ( $product->is_type( 'variation' ) ) {
/**
* Action to signal that the `stock_status` for a variation has changed.
*
* @since 3.0
*
* @param int $product_id The ID of the variation.
* @param string $stock_status The new stock status of the variation.
* @param WC_Product $product The product object.
*/
do_action( 'woocommerce_variation_set_stock_status', $product->get_id(), $product->get_stock_status(), $product );
} else {
/**
* Action to signal that the `stock_status` for a product has changed.
*
* @since 3.0
*
* @param int $product_id The ID of the product.
* @param string $stock_status The new stock status of the product.
* @param WC_Product $product The product object.
*/
do_action( 'woocommerce_product_set_stock_status', $product->get_id(), $product->get_stock_status(), $product );
}
}