Skip to content

Commit ce5557e

Browse files
dgjlindsayclaude
andcommitted
ABN-298/fix: total collector guard — check items, not address type
The address type check could return early on valid assignments where getAddressType() was empty. Use the standard Magento pattern of checking for items in the shipping assignment instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 711cb73 commit ce5557e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Model/Total/Surcharge.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function collect(
6464
): self {
6565
parent::collect($quote, $shippingAssignment, $total);
6666

67-
// Only run on the shipping address (avoid double-counting on billing)
68-
if (!$shippingAssignment->getShipping()->getAddress()->getAddressType()) {
67+
// Only run when there are items (avoids double-counting on empty assignments)
68+
if (!count($shippingAssignment->getItems())) {
6969
return $this;
7070
}
7171

0 commit comments

Comments
 (0)