WC_Data_Store_WP::update_lookup_table( int $id, string $table )
Update a lookup table for an object.
Description Description
Parameters Parameters
- $id
-
(Required) ID of object to update.
- $table
-
(Required) Lookup table name.
Return Return
(NULL)
Source Source
File: includes/data-stores/class-wc-data-store-wp.php
protected function update_lookup_table( $id, $table ) {
global $wpdb;
$id = absint( $id );
$table = sanitize_key( $table );
if ( empty( $id ) || empty( $table ) ) {
return false;
}
$existing_data = wp_cache_get( 'lookup_table', 'object_' . $id );
$update_data = $this->get_data_for_lookup_table( $id, $table );
if ( ! empty( $update_data ) && $update_data !== $existing_data ) {
$wpdb->replace(
$wpdb->$table,
$update_data
);
wp_cache_set( 'lookup_table', $update_data, 'object_' . $id );
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |