diff --git a/wp_robokassa.php b/wp_robokassa.php index 33f5672..dbc55fe 100644 --- a/wp_robokassa.php +++ b/wp_robokassa.php @@ -618,6 +618,21 @@ function getRobokassaPasses() */ function createRobokassaReceipt($order_id) { + /** + * Filter to allow custom receipt generation. + * Return a non-null value to bypass default receipt creation. + * + * @param array|null $pre_receipt Custom receipt data or null to use default. + * @param int $order_id Order ID. + * + * @since 1.6.6 + */ + $pre_receipt = apply_filters('robokassa_receipt_pre', null, $order_id); + + if ($pre_receipt !== null) { + return $pre_receipt; + } + global $woocommerce; $order = new WC_Order($order_id); @@ -722,7 +737,7 @@ function createRobokassaReceipt($order_id) robokassa_payment_DEBUG('Robokassa: общая сумма чека (' . $total_receipt . ') НЕ совпадает с общей суммой заказа (' . $total_order . ')'); } - return apply_filters('wc_robokassa_receipt', $receipt); + return apply_filters('wc_robokassa_receipt', $receipt, $order_id); } /**