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.
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.
Related
Take this example:
A user places an order for 2 items on a WooCommerce shop. The order is picked up (using REST) by a POS (Point-of-Sale) system. The owner discovers that only one of the items is available (for whatever reason) and decides to amend the order by removing the non-existing item.
How does the POS system tell WooCommerce (via REST API) that the order is "completed" (so that WooCommerce plug-in can do the capture (charge) of the payment at the payment provider), but at the same time tells WooCommerce that it should only charge the price for the one item, and not the price registered on the order?
In another shop we manage, we can tell the shop the amount to charge when we change the order status to "completed" - how do we do this properly in WooCommerce?
Option 1:
Some payment methods e.g. PayPal allows you to authorize (reserve the amount) without capturing it right away, so this could be used to address your issue in the following flow:
Payment method payment action is set to Authorize to reserve the funds on customers account.
Customer places an online order.
POS system calls GET /wp-json/wc/v3/orders/<id> to retrieve order details.
Optional. Changes are made to order items and PUT /wp-json/wc/v3/orders/<id> Rest API endpoint called to update the order details.
Another PUT /wp-json/wc/v3/orders/<id> request is made to change order status from processing to completed. This will trigger payment method to capture the funds based on current order total.
Note: It might be possible to combine steps 4 and 5.
Option 2:
If payment method you are using does not support authorizations, your other option is refunds.
Payment method configured to capture the funds.
Customer places an online order.
POS system calls GET /wp-json/wc/v3/orders/<id> to retrieve order details.
PUT /wp-json/wc/v3/orders/<id> request is made to change order status from processing to completed.
A refund in desired amount can be created by calling POST /wp-json/wc/v3/orders/<id>/refunds end point.
Note: Some payment methods do not support partial refunds. A REST API call will be needed to update order and remove products that could not be shipped. You may need to test when it is the best time to make such call so it does not affect refund/order totals.
I'm trying to create a situation in which a guarantee (no VAT) is automatically added to the cart when you order a variable subscription product. This should be done only one with the first transaction, not with the next payment in the subscription, therefore a grouped product construction.
I try to do this with the plugins mentioned above, but it simply doesn't appear in the shopping cart.
Any idea why and how to fix it?
For the grouped product, see also: https://www.rentyourmac.com/product/the-master-macbook-test-subscription/
We set up enhanced ecommerce tracking for our shop where we among other things track payment method for each order. In our shop, as a customer, I completed two orders with visa payment option, which can be seen in GA:
Two orders created with visa option, all fine (don't mind the duplicate records for now).
But then I create a third order in our shop with sofort banking (just another payment option) and look how things change:
All order payment methods were changed to sofort banking. Of course I've tried hard reload to see if caching is not involved and even waited a day to see if it changes anything but no, the records stay with sofort banking.
Now we come to the second problem - the duplication. For some reason when I filter with Secondary dimension: Checkout Options (as can be seen on the pics) I get for each tracked order 2 records in the table. Those two problems might be somehow connected.
The question is: Does anyone have an experience with this and knows where the problem might be? If you need additional info please let me know, as of now I don't know in which direction to elaborate.
After taking some online tutorials I am willing to create my own custom theme for my myself. This is going to be an online Contact Lense store! So far I have learned how to generate and use Custom Post Types, Custom Taxonamyies, Metaboxes , and Option pages.but there is still one confusing part left for me(hopefully not more! :-))
I need to get some user inputs through HTML Select Options like following image to finalize the users orders:
Now my question is:
1- Do I have to create some thing lik Metaboxes to manipulate these data from users?
2- can I handle these kind of data through simple Form ans Post function in PHP? If so where should I store these data? Do I have to create a table on my own to handle these things?
I really appreciate your time regrading this post,
What you're asking for carries a little more complexity than you think!
Let's break this down into its meaningful steps:
A user visits your shop, and decides that they like what they see and wants to make an order
The user fills out a form defining their exact eye requirements, quantity, as well as their contact information
Upon completing this form, a new order has been created
But wait.... how will you get paid? What happens if the user's computer explodes before the payment goes through? How will you know to send them their contacts without first knowing the payment even succeeded?
This is where things start to get tricky. You need to be able to keep a record of orders for the sake of your users, but you also need to look out for your own interests too. Your business is doomed to fail if you're sending out expensive products to people without the proper assurance that you're getting paid.
This is where you'll need to set up a Merchant Account with a service like PayPal or Google Checkout. As much as I despise PayPal, their Instant Payment Notification (IPN) System has been very reliable for me. What this does is automatically send a POST request to your server with all of the information you need to finalize the checkout process and alert your user that their payment has either succeeded or failed.
So with this in mind, how does this affect our step-by-step process?
A user visits your shop, and decides that they like what they see and wants to make an order
The user fills out a form defining their exact eye requirements, quantity, as well as their contact information
Upon completing this form, a new order has been created with a status of pending
The user is then sent to PayPal/Google Checkout to enter their Credit Card information to complete their purchase
PayPal/Google processes the payment
PayPal/Google sends your server the results of the processed payment
The corresponding order is updated with a status of Payment Received or Payment Failed for your own records
You send out the product to a very satisfied customer
So what will this mean from a Wordpress standpoint?
My first suggestion:
Check if a Plugin already exists that can handle this for you!!!
Seriously, this will make your life much easier. Handling people's money as well as your own stock is a nightmare all in itself, you don't want to be responsible for handling the code that drives it, or the possibility of security holes that you might not know about (that other plugins may have already addressed). WooCommerce is a popular one. See if that can handle what you need.
If a Plugin can't do it for you, then you'll need to:
Register a Custom Post Type for Orders
Create a new Order Post using wp_insert_post when a user submits the form with their POST data
Save the relevant POST data you need as metadata using update_post_meta
Send PayPal/Google/Whatever some Custom Information it needs to hang on to - in this case, the newly created Order Post ID - so that it can send it back to your own server
Set up a side-script to process the data sent by PayPal/Google Checkout/Whatever and send an email to the user detailing the status of their purchase and update the corresponding Order Post ID that was sent back by PayPal/Google Checkout/Whatever
(Optional) Set up a CRON Job to periodically scan all Pending orders in case a user's session was interrupted, or they bailed at the last second during checkout and send them an email notifying them about this and provide them a link to your website to reopen, reevaluate, and resend the order, or cancel and clear it from your database
Quite honestly, this would take even a seasoned Developer at least a few weeks worth of work just to get it in working condition. Presentation is a whole different animal.
Hopefully this will give you a step in the right direction. I doubt anybody here will give you the code to do what you need, because there's just too much to post. Entire libraries are built just for these kinds of things.
Good luck!
This is related to Drupal 6 & Ubercart...
Is it safe to erase in-checkout orders from a user, except from the last in-checkout order?
The problem is that a user can create multiple orders with "in checkout" status, and it could be confusing for an administrator look multiple orders from the same user. Moreover, the user can only see his last in-checkout order, the rest in-checkout orders are lost... (or not?)
I think a user will never see past in-checkout orders... If a user generates a new order then pasts orders from him should be erased...? Seeing these orders in the history could generate confusion.
Is it safe to delete past in-checkout orders from the same user?
might be a solution.
After hours of head banging, I had to hack the core ubercart drupal module. I dont know why but the ubercart uc_cart.module unsets the order session everytime the ubercart checkout page is loaded. Hence when the page is loaded or any validation error is there on the checkout page, a new order id is created for preventing the identity theft(which i have no clue what it is).
Coming back to my point. I just commented out the line 142 and 150 in uc_cart.pages.inc of ubercart.
eg:- unset($_SESSION['cart_order']);
I m in drupal 6 ubercart
Now since the cart order is not unset hence there are no multiple in checkout status order created. Seems to be working fine for now. I know that hacking core ubercart module is not good, but i couldn't fine any other solution for this. Please do reply if it will cause any future error.
Thank you.