woocommerce_update_product_stock_query

woocommerce_update_product_stock_query

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_update_product_stock_query') is found 2 times:

  • /includes/data-stores/class-wc-product-data-store-cpt.php line 1367
    			$stock_quantity,
    			$product_id_with_stock
    		);
    
    		$sql = apply_filters( 'woocommerce_update_product_stock_query', $sql, $product_id_with_stock, $stock_quantity, 'set' );
    
    		$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared
    
    		// Cache delete is required (not only) to set correct data for lookup table (which reads from cache).
    		// Sometimes I wonder if it shouldn't be part of update_lookup_table.
    		wp_cache_delete( $product_id_with_stock, 'post_meta' );
    
  • /includes/data-stores/class-wc-product-data-store-cpt.php line 1436
    				$product_id_with_stock
    			);
    		}
    
    		$sql = apply_filters( 'woocommerce_update_product_stock_query', $sql, $product_id_with_stock, $new_stock, $operation );
    
    		$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared
    
    		// Cache delete is required (not only) to set correct data for lookup table (which reads from cache).
    		// Sometimes I wonder if it shouldn't be part of update_lookup_table.
    		wp_cache_delete( $product_id_with_stock, 'post_meta' );