问题
I'm having a problem with WordPress/Woocommerce creating a second order for customers. This is leading to a couple issues that I'll outline below. Here is the process I am following:
- Create and populate new Woocommerce Subscription object
- Create new renewal order (this will be ID 1033 below) and send invoice to customer
- Customer logs in and finds the pending order in My Account page
- Customer opens the pending order and it is populated with the correct products and price. Customer pays the correct amount
- After payment, customer is on the receipt screen but it is for a new order. The old order is still sitting on their account as pending.
After looking at the access log, I can see this:
- Here is the entry link (pre-payment): /checkout/order-pay/1033
- And here is the review link (post-payment): /checkout/order-received/1055
The problems I am encountering are:
- I have tested completing payments more than dozen times and was only able to replicate it the first time. I have followed those same steps as much as possible to no avail (all other transactions are processing as expected without creating extra orders)
- The initial order is connected to a subscription, and upon completed payment the subscription is set to automatic payments. This issue of having a new order is detaching it, and automatic payments cannot be enabled until after the next payment is processed (a month later), and will rely on the customer manually submitting the order again.
Does anyone have any idea why WordPress/Woocommerce is creating a second order upon payment.
回答1:
I was having the same issue with renewal payments getting applied to a new order. In my case, I was consistently having this issue with manually added subscriptions, as well as with imported subscriptions.
After working with Woocommerce Subscriptions Support, they came out with an update (version 2.1.0) solving the issue for me. Their change log references the fix.
Fix: Do not create new orders when processing a renewal and resubscribe payment with different details to the original order by ensuring the cart hash used by WooCommerce is updated when creating the order. (PR#1687)
Try updating Woocommerce Subscriptions to version 2.1.0.
来源:https://stackoverflow.com/questions/40370911/woocommerce-checkout-process-creating-new-order-at-payment