WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::update_stock_status_for() private WC 1.0

Update the stock status of the lookup table entries for a given product.

{} It's a method of the class: LookupDataStore{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->update_stock_status_for( $product );
$product(WC_Product) (required)
The product to update the entries for.

Code of LookupDataStore::update_stock_status_for() WC 5.9.0

private function update_stock_status_for( \WC_Product $product ) {
	global $wpdb;

	$in_stock = $product->is_in_stock();

	// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
	$wpdb->query(
		$wpdb->prepare(
			'UPDATE ' . $this->lookup_table_name . ' SET in_stock = %d WHERE product_id = %d',
			$in_stock ? 1 : 0,
			$product->get_id()
		)
	);
	// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
}