-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Banktransfer orders are placed on-hold. When payment expires, or fails, ... #27
Conversation
…s, the ordered products will be restocked
// Don't update an already paid order | ||
if (!$order->needs_payment()) | ||
// Don't update an already paid order, needs_payment() searches by valid_statusses, but does not include on-hold status, so we add it here. | ||
if (!$order->needs_payment() && $order->post->post_status != 'wc-on-hold') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$order->post
bestaat bij mij niet in WooCommerce 2.1.10. Wel heb ik $order->status = 'on-hold'
. Laatste versie lijkt dit inderdaad via $order->post
te doen. Je kunt dan ook gebruik maken van $order->get_status()
. https://github.com/woothemes/woocommerce/blob/master/includes%2Fabstracts%2Fabstract-wc-order.php#L880
Deze methode is helaas niet in mijn versie beschikbaar.
Ik heb mij vergist met voorraad afboeken bij on-hold status. Dit is niet nodig. Bij Nu wordt de voorraad 2x afgeboekt. In deze wijziging en bij rapporteren banktransfer paid in Je hoeft bij het aanmaken van de banktransfer payment alleen de order status te updaten naar Na rapporteren 'paid' zal de voorraad automatisch worden afgeboekt in |
if ($this->id == Mollie_API_Object_Method::BANKTRANSFER) | ||
{ | ||
$order->update_status('on-hold', __('Awaiting payment confirmation', 'MPM')); | ||
$order->reduce_order_stock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reduce_order_stock
is dus niet nodig. Gebeurt bij rapporteren paid
in $order->payment_complete()
@@ -173,7 +173,15 @@ public function process_payment($order_id) | |||
return array('result' => 'failure'); | |||
} | |||
|
|||
$order->update_status('pending', __('Awaiting payment confirmation', 'MPM')); | |||
// We put a banktransfer order 'on-hold'. Woo will deduct stock and won't cancel the order after # minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is niet helemaal correct maar dat maakt niet uit. Voorraad wordt pas bij $order->payment_complete
afgeboekt. update_status('on-hold')
doet niks anders dan status wijzigen.
...the ordered products will be restocked