WordPress at Your Fingertips
function is not described

WC_Data_Store_WP::get_db_info() protected WC 3.0.0

Table structure is slightly different between meta types, this function will return what we need to know.

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

No Hooks.

Return

Array. Array elements: table, object_id_field, meta_id_field

Usage

// protected - for code of main (parent) or child class
$result = $this->get_db_info();

Changelog

Since 3.0.0 Introduced.

Code of WC_Data_Store_WP::get_db_info() WC 5.8.0

protected function get_db_info() {
	global $wpdb;

	$meta_id_field = 'meta_id'; // for some reason users calls this umeta_id so we need to track this as well.
	$table         = $wpdb->prefix;

	// If we are dealing with a type of metadata that is not a core type, the table should be prefixed.
	if ( ! in_array( $this->meta_type, array( 'post', 'user', 'comment', 'term' ), true ) ) {
		$table .= 'woocommerce_';
	}

	$table          .= $this->meta_type . 'meta';
	$object_id_field = $this->meta_type . '_id';

	// Figure out our field names.
	if ( 'user' === $this->meta_type ) {
		$meta_id_field = 'umeta_id';
		$table         = $wpdb->usermeta;
	}

	if ( ! empty( $this->object_id_field_for_meta ) ) {
		$object_id_field = $this->object_id_field_for_meta;
	}

	return array(
		'table'           => $table,
		'object_id_field' => $object_id_field,
		'meta_id_field'   => $meta_id_field,
	);
}