Describe your bug or feature request.

/admin/commerce/orders/***/payments caches the order entity. So, if you edit an order and add an item, then go to the payments tab, the balance field is wrong.

If a bug, provide steps to reproduce it from a clean install.

See above. The payment tab views caches based on payment entity. But, in the simple case I mentioned above, payments don't change, but order changed.

and discussed happened on Slack https://drupal.slack.com/archives/C1TLCCF9B/p1669116645354739

Proposed solution

Remove the caching on Payment Tab view.

CommentFileSizeAuthor
#2 3323121-2.patch548 bytesskyredwang

Issue fork commerce-3323121

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

skyredwang created an issue. See original summary.

skyredwang’s picture

Status: Active » Needs review
StatusFileSize
new548 bytes

Tested: After removing the views cache, the balance shows correct amount whenever you add or remove items.

Status: Needs review » Needs work

The last submitted patch, 2: 3323121-2.patch, failed testing. View results

travis-bradbury’s picture

I suggest that rather than disabling caching on the view, cache metadata for the order should be attached to the payment total summary. I'm making a guess that this is where the issue is.

The balance is in the commerce_payment_total_summary views area. It could add the order's cache metadata to the render array there.

kiwad’s picture

I had something similar.

Ended up patching manual gateway

+++ web/modules/contrib/commerce/modules/payment/src/Plugin/Commerce/PaymentGateway/Manual.php  2026-03-20 14:38:55.359526772 +0000
@@ -208,6 +208,13 @@
     $payment->state = 'completed';
     $payment->setAmount($amount);
     $payment->save();
+
+    $order = $payment->getOrder();
+    if ($order) {
+      /** @var \Drupal\commerce_payment\PaymentOrderUpdaterInterface $payment_order_updater */
+      $payment_order_updater = \Drupal::service('commerce_payment.order_updater');
+      $payment_order_updater->updateOrder($order, TRUE);
+    }
   }

   /**

tbkot made their first commit to this issue’s fork.

tbkot’s picture

Status: Needs work » Needs review

  • jsacksick committed 55275dd8 on 3.x authored by tbkot
    fix: #3323121 Payments Tab show stale information
    
    By: skyredwang
    By:...
jsacksick’s picture

Version: 3.0.x-dev » 3.x-dev
Status: Needs review » Fixed

@tbkot: Looks good thank you! Committed.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.