WC_Post_Data::delete_order_items()public staticWC 1.0

Remove item meta on permanent deletion.

Метод класса: WC_Post_Data{}

Возвращает

null. Ничего.

Использование

$result = WC_Post_Data::delete_order_items( $postid );
$postid(int) (обязательный)
Post ID.

Код WC_Post_Data::delete_order_items() WC 7.3.0

public static function delete_order_items( $postid ) {
	global $wpdb;

	if ( OrderUtil::is_order( $postid, wc_get_order_types() ) ) {
		do_action( 'woocommerce_delete_order_items', $postid );

		$wpdb->query(
			"
			DELETE {$wpdb->prefix}woocommerce_order_items, {$wpdb->prefix}woocommerce_order_itemmeta
			FROM {$wpdb->prefix}woocommerce_order_items
			JOIN {$wpdb->prefix}woocommerce_order_itemmeta ON {$wpdb->prefix}woocommerce_order_items.order_item_id = {$wpdb->prefix}woocommerce_order_itemmeta.order_item_id
			WHERE {$wpdb->prefix}woocommerce_order_items.order_id = '{$postid}';
			"
		); // WPCS: unprepared SQL ok.

		do_action( 'woocommerce_deleted_order_items', $postid );
	}
}