Refunds: Bug fixes in getting right gateway object
This commit is contained in:
parent
b4d17940de
commit
c99ec141d8
|
@ -372,14 +372,14 @@ function woocommerce_order_items_meta_box( $post ) {
|
||||||
$gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
|
$gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
|
||||||
|
|
||||||
if ( isset( $gateways[ $order->payment_method ] ) ) {
|
if ( isset( $gateways[ $order->payment_method ] ) ) {
|
||||||
$gateway = $order->payment_method;
|
$gateway = $gateways[ $order->payment_method ];
|
||||||
|
|
||||||
if ( ! in_array( 'refunds', $gateway->supports ) || ! method_exists( $gateway, 'refund' ) ) {
|
if ( ! in_array( 'refunds', $gateway->supports ) || ! method_exists( $gateway, 'refund' ) ) {
|
||||||
$disabled = ' disabled="disabled"';
|
$disabled = ' disabled="disabled"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<option value="refund"' . $disabled . '>' . _e( 'Refund Lines', 'woocommerce' ) . '</option>';
|
echo '<option value="refund"' . $disabled . '>' . __( 'Refund Lines', 'woocommerce' ) . '</option>';
|
||||||
?>
|
?>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="<?php _e( 'Stock Actions', 'woocommerce' ); ?>">
|
<optgroup label="<?php _e( 'Stock Actions', 'woocommerce' ); ?>">
|
||||||
|
|
|
@ -964,7 +964,7 @@ function woocommerce_ajax_refund_order_item() {
|
||||||
$gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
|
$gateways = $woocommerce->payment_gateways->get_available_payment_gateways();
|
||||||
|
|
||||||
if ( isset( $gateways[ $order->payment_method ] ) ) {
|
if ( isset( $gateways[ $order->payment_method ] ) ) {
|
||||||
$gateway = $order->payment_method;
|
$gateway = $gateways[ $order->payment_method ];
|
||||||
|
|
||||||
if ( in_array( 'refunds', $gateway->supports ) && method_exists( $gateway, 'refund' ) ) {
|
if ( in_array( 'refunds', $gateway->supports ) && method_exists( $gateway, 'refund' ) ) {
|
||||||
$order_item_ids = $_POST['order_item_ids'];
|
$order_item_ids = $_POST['order_item_ids'];
|
||||||
|
|
Loading…
Reference in New Issue