woocommerce_printable_order_receipt_data хук-фильтрWC 9.0.0

Filter to customize the set of data that is used to render the receipt. The formatted line items aren't included, use the woocommerce_printable_order_receipt_formatted_line_item filter to customize those.

See the value returned by the 'get_order_data' and 'get_woo_pay_data' methods for a reference of the structure of the data.

See the template file, Templates/order-receipt.php, for reference on how the data is used.

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

add_filter( 'woocommerce_printable_order_receipt_data', 'wp_kama_woocommerce_printable_order_receipt_data_filter', 10, 2 );

/**
 * Function for `woocommerce_printable_order_receipt_data` filter-hook.
 * 
 * @param array             $data  The original set of data.
 * @param WC_Abstract_Order $order The order for which the receipt is being generated.
 *
 * @return array
 */
function wp_kama_woocommerce_printable_order_receipt_data_filter( $data, $order ){

	// filter...
	return $data;
}
$data(массив)
The original set of data.
$order(WC_Abstract_Order)
The order for which the receipt is being generated.

Список изменений

С версии 9.0.0 Введена.

Где вызывается хук

ReceiptRenderingEngine::generate_receipt()
woocommerce_printable_order_receipt_data
woocommerce/src/Internal/ReceiptRendering/ReceiptRenderingEngine.php 134
$data = apply_filters( 'woocommerce_printable_order_receipt_data', $this->get_order_data( $order ), $order );

Где используется хук в WooCommerce

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