Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStore::get_refund_orders_batch_join_clause
Returns a prepared SQL JOIN clause for finding refund orders belonging to multiple parent orders.
Overrides the CPT version to use the HPOS orders table.
Method of the class: OrdersTableDataStore{}
No Hooks.
Returns
String. Prepared SQL JOIN fragment.
Usage
// protected - for code of main (parent) or child class $result = $this->get_refund_orders_batch_join_clause( $order_ids ): string;
- $order_ids(array) (required)
- List of order IDs.
Changelog
| Since 10.7.0 | Introduced. |
OrdersTableDataStore::get_refund_orders_batch_join_clause() OrdersTableDataStore::get refund orders batch join clause code WC 10.7.0
protected function get_refund_orders_batch_join_clause( array $order_ids ): string {
global $wpdb;
$id_list = implode( ', ', array_map( 'absint', $order_ids ) );
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $id_list is sanitized via absint above.
return $wpdb->prepare( "%i AS refunds ON ( refunds.type = %s AND refunds.parent_order_id IN ( $id_list ) )", self::get_orders_table_name(), 'shop_order_refund' );
}