Not _payment_method added on order meta
[ad_1]
Hi,
I use the plugin only for Revolut Pay method, which works well, but there is a missing thing which may create incompatibilities with other plugins and code. Almost all wc payment methods, add _payment_method and _payment_method_title in their order data, but this Plugin seems not to. I have checked all my revolut orders in the db and neither of these two seem to be added. Looking at your code, the place i found responsible for adding payment method title only looks for Apple and Google pay method (?) and thus doesnt add it for Revolut Pay. Here is the function:
protected function update_payment_method_title( $revolut_order_id, $wc_order ) {
try {
if ( ‘revolut_payment_request’ !== $this->id ) {
return;
}
$revolut_order = $this->api_client->get( ‘/orders/’ . $revolut_order_id );
$revolut_order_total = $this->get_revolut_order_amount( $revolut_order );
$revolut_order_currency = $this->get_revolut_order_currency( $revolut_order );
if ( empty( $revolut_order_total ) || empty( $revolut_order_currency ) ) {
/* translators: %s: Revolut order id. */
$wc_order->add_order_note( sprintf( __( 'Can\'t retrieve payment amount for this order. Please check your Revolut Business account (Order ID: %s)', 'revolut-gateway-for-woocommerce' ), $revolut_order_id ) );
return;
}
if ( ! isset( $revolut_order['payments'][0]['payment_method']['type'] ) || empty( $revolut_order['payments'][0]['payment_method']['type'] ) ) {
return;
}
$payment_method = $revolut_order['payments'][0]['payment_method']['type'];
if ( 'APPLE_PAY' === $payment_method ) {
$payment_method_title="Apple Pay (via Revolut)";
} elseif ( 'GOOGLE_PAY' === $payment_method ) {
$payment_method_title="Google Pay (via Revolut)";
} else {
$payment_method_title = $this->title;
}
$wc_order->set_payment_method_title( $payment_method_title );
$wc_order->save();
} catch ( Exception $e ) {
$this->log_error( $e->getMessage() );
}
}
This may lead to problems with other plugins code since woocommerce expects the payment method to be set on orders.
[ad_2]
مشاهده پاسخ های این مطلب
———————————————
این مطلب از سایت انجمن وردپرس گردآوری شده است و کلیه حقوق مطلق به انجمن وردپرس می باشد در صورت مغایرت و یا بروز مشکل اطلاع دهید تا حذف گردد
منبع: انجمن وردپرس