This prevents us from saving the order object when we're on the "add payment method" page. We do this by ensuring we don't call any save methods if the order doesn't already have an ID number. When on the payment method page, we expect to be working with a WC_Order object that has a 0 ID which is why this works.
The initial $order->save() method has been removed. This was added to avoid potential errors, but thus far we haven't been able to reproduce any errors with that line removed.
Using authorize.net I tested the following:
Placing an order, using an existing/saved payment method; and
Placing an order, using a brand new payment method
In both cases the order was created successfully and the charge went through.
Summary
This prevents us from saving the order object when we're on the "add payment method" page. We do this by ensuring we don't call any save methods if the order doesn't already have an ID number. When on the payment method page, we expect to be working with a
WC_Order
object that has a0
ID which is why this works.Issue: MWC-16645 & MWC-16316
Details
The initial
$order->save()
method has been removed. This was added to avoid potential errors, but thus far we haven't been able to reproduce any errors with that line removed.Using authorize.net I tested the following:
In both cases the order was created successfully and the charge went through.
QA
Authorize.net
See https://github.com/gdcorp-partners/woocommerce-gateway-authorize-net-cim/pull/98
Elavon
See https://github.com/gdcorp-partners/woocommerce-gateway-elavon/pull/94
Before Merge