From 8e87764433fc59696139d16e53505128dfff893d Mon Sep 17 00:00:00 2001 From: davdebcom Date: Mon, 14 Aug 2017 19:49:18 +0200 Subject: [PATCH] For renewal order payment method update: add WooCommerce 3.0 code and remove creditcard from checked methods --- .../mollie/wc/gateway/abstractsubscription.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstractsubscription.php b/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstractsubscription.php index f930de890..a6820a74f 100644 --- a/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstractsubscription.php +++ b/mollie-payments-for-woocommerce/includes/mollie/wc/gateway/abstractsubscription.php @@ -251,14 +251,19 @@ public function scheduled_subscription_payment( $amount_to_charge, $renewal_orde 'mollie_wc_gateway_sofort', 'mollie_wc_gateway_kbc', 'mollie_wc_gateway_belfius', - 'mollie_wc_gateway_creditcard', // TODO DAVID -- REMOVE ); $current_method = get_post_meta( $renewal_order_id, '_payment_method', $single = true ); if ( in_array( $current_method, $methods_needing_update ) && $payment->method == 'directdebit' ) { - update_post_meta( $renewal_order_id, '_payment_method', 'mollie_wc_gateway_directdebit' ); - update_post_meta( $renewal_order_id, '_payment_method_title', 'SEPA Direct Debit' ); + if ( version_compare( WC_VERSION, '3.0', '<' ) ) { + update_post_meta( $renewal_order_id, '_payment_method', 'mollie_wc_gateway_directdebit' ); + update_post_meta( $renewal_order_id, '_payment_method_title', 'SEPA Direct Debit' ); + } else { + $renewal_order->update_meta_data( '_payment_method', 'mollie_wc_gateway_directdebit' ); + $renewal_order->update_meta_data( '_payment_method_title', 'SEPA Direct Debit' ); + $renewal_order->save(); + } } Mollie_WC_Plugin::debug($this->id . ': Created payment for order ' . $renewal_order_id. ' payment json response '.json_encode($payment));