Problem/Motivation
PHP error on checkout page under these conditions:
- Shippingable products
- Shipping method with a condition on an address
- Workflow settings for checkout: shipping - do not hide shipping
When shipping address form initially built no address exists but shipping method conditions are evaluated.
Proposed resolution
Check for null address in condition evaluation and return false.
Error Logged
TypeError: Argument 1 passed to CommerceGuys\Addressing\Zone\Zone::match() must implement interface CommerceGuys\Addressing\AddressInterface, null given, called in /var/www/drupalvm/drupal/web/modules/contrib/commerce_shipping/src/Plugin/Commerce/Condition/ShipmentAddress.php on line 83 in CommerceGuys\Addressing\Zone\Zone->match() (line 93 of /var/www/drupalvm/drupal/vendor/commerceguys/addressing/src/Zone/Zone.php) #0 /var/www/drupalvm/drupal/web/modules/contrib/commerce_shipping/src/Plugin/Commerce/Condition/ShipmentAddress.php(83): CommerceGuys\Addressing\Zone\Zone->match(NULL)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2927898-1.patch | 818 bytes | troseman |
Comments
Comment #2
troseman commentedComment #3
troseman commentedComment #4
bojanz commentedComment #6
bojanz commentedAdded a test, and committed. Thanks!