Automattic\WooCommerce\Internal\DataStores

CustomMetaDataStore::delete_meta()publicWC 1.0

Deletes meta based on meta ID.

Method of the class: CustomMetaDataStore{}

No Hooks.

Return

true|false.

Usage

$CustomMetaDataStore = new CustomMetaDataStore();
$CustomMetaDataStore->delete_meta( $object, $meta ) : bool;
$object(WC_Data) (required) (passed by reference — &)
WC_Data object.
$meta(stdClass) (required)
(containing at least ->id).

CustomMetaDataStore::delete_meta() code WC 8.7.0

public function delete_meta( &$object, $meta ) : bool {
	global $wpdb;

	if ( ! isset( $meta->id ) ) {
		return false;
	}

	$db_info = $this->get_db_info();
	$meta_id = absint( $meta->id );

	return (bool) $wpdb->delete( $db_info['table'], array( $db_info['meta_id_field'] => $meta_id ) );
}