Automattic\WooCommerce\Internal\ProductAttributesLookup

LookupDataStore::delete_data_for()privateWC 1.0

Delete all the lookup table entries for a given product, if it's a variable product information for variations is deleted too.

Method of the class: LookupDataStore{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->delete_data_for( $product_id );
$product_id(int) (required)
Simple product id, or main/parent product id for variable products.

LookupDataStore::delete_data_for() code WC 8.6.1

private function delete_data_for( int $product_id ) {
	global $wpdb;

	// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
	$wpdb->query(
		$wpdb->prepare(
			'DELETE FROM ' . $this->lookup_table_name . ' WHERE product_id = %d OR product_or_parent_id = %d',
			$product_id,
			$product_id
		)
	);
	// phpcs:enable WordPress.DB.PreparedSQL.NotPrepared
}