-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New order status setting for Zero Subtotal Checkout in back-end orders is not working #13552
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
Comments
Here is some additional info. The fallback behavior is now working properly in my test site. But I tracked the issue down to the following. In $action = $methodInstance->getConfigPaymentAction();
if ($action) {
if ($methodInstance->isInitializeNeeded()) {
$stateObject = new \Magento\Framework\DataObject();
// For method initialization we have to use original config value for payment action
$methodInstance->initialize($methodInstance->getConfigData('payment_action'), $stateObject);
$orderState = $stateObject->getData('state') ?: $orderState;
$orderStatus = $stateObject->getData('status') ?: $orderStatus;
$isCustomerNotified = $stateObject->hasData('is_notified')
? $stateObject->getData('is_notified')
: $isCustomerNotified;
} else {
$orderState = Order::STATE_PROCESSING;
$this->processAction($action, $order);
$orderState = $order->getState() ? $order->getState() : $orderState;
$orderStatus = $order->getStatus() ? $order->getStatus() : $orderStatus;
}
} else {
$order->setState($orderState)
->setStatus($orderStatus);
} For the front-end, the "Zero Subtotal Checkout" payment method will still run a payment action (authorize/capture). In particular, the following code is run (first part of the outer IF, second part of the inner IF): $orderState = Order::STATE_PROCESSING;
$this->processAction($action, $order);
$orderState = $order->getState() ? $order->getState() : $orderState;
$orderStatus = $order->getStatus() ? $order->getStatus() : $orderStatus; So basically, the order state will be set to However, in back-end orders for a store view, the $order->setState($orderState)
->setStatus($orderStatus); Since if (!array_key_exists($orderStatus, $order->getConfig()->getStateStatuses($orderState))) {
$orderStatus = $order->getConfig()->getStateDefaultStatus($orderState);
} And that causes the problem for us. Now, as for solving the issue, our use case actually requires us to move the state and the status both to However, the following questions remain:
|
@leoquijano, thank you for your report. |
#MM19IN |
Hi @brideo. Thank you for working on this issue.
|
Cool, I will start today. |
Hi @engcom-Charlie. Thank you for working on this issue.
|
Hello @leoquijano Thank you for contribution and collaboration! We are not able to reproduce this issue on the lates We are closing this issue due to branch If you still faced this issue on |
I am still able to reproduce this with "automatically invoice all items" turned off ... |
This might be related to #5860, but in a different area.
Preconditions
Using a brand new Magento 2.2.2 setup in PHP v7.1, MySQL 5.7.21 and Apache 2.24, I set up the following:
Steps to reproduce
After setting that configuration up, I configure the Zero Subtotal Checkout payment method (Stores -> Configuration -> Sales -> Payment Methods), to set the order status to "Processing" instead of "Pending" . I do this under the "Default Config" configuration.
Expected result
When I create a new order in the back-end for a customer in the US Store View (i.e., not the default view), the order should be set to "Processing" status.
Even though I didn't set a website specific configuration for that option, the fallback mechanism should guarantee that my default order status is the one used.
Actual result
The order stays in "Pending" status.
Comments
I tried the workaround mentioned in #5860. It works on the front-end, but it doesn't work when placing orders from the admin area. For some reason, in
vendor/magento/module-payment/Model/Method/AbstractMethod.php
, methodgetConfigData
, the retrieval for the configuration ofpayment/free/order_status
doesn't fallback properly.This method returns NULL for the US Store View, which in turn means that the following code sets the wrong status:
In
vendor/magento/module-sales/Model/Order/Payment.php
:(Note that
$action
is empty in the admin area, which is also strange, but then again, I'm using the zero subtotal checkout payment method)The text was updated successfully, but these errors were encountered: