Articles on: Magento 2 User Guide

Magento 2 issue Checkout error - region could not be converted to string [solution]

A recurring Magento 2 checkout issue can throw the error “region could not be converted to string” when the shipping/billing region is empty or not mapped correctly. A simple workaround is to install a small module that gracefully handles the missing/invalid region so checkout can proceed.


magento2-checkout-region-could-not-be-converted-to-string-error.png



Why this happens

Magento may attempt to cast the region (state/province) to a string during quote/checkout processing. If the region is null, empty, or stored as a non-string type, the operation can fail and abort the checkout flow.



Community workaround module

A lightweight community module provides a safe fallback to prevent the error:



This does not change your storefront behavior; it only guards against the faulty cast so the order can be placed.



How to install


Option A — Composer (VCS)

If the package isn’t on Packagist, add it as a VCS repository and require it:


// composer.json (add under "repositories")
{
"type": "vcs",
"url": "https://github.com/gloong/module-quote"
}


Then install & enable:


composer require gloong/module-quote:dev-master
php bin/magento module:enable Gloong_Quote --clear-static-content
php bin/magento setup:upgrade
php bin/magento cache:flush


Option B — Manual (app/code)

  1. Download or clone the repo into:
   app/code/Gloong/Quote
  1. Enable & upgrade:
   php bin/magento module:enable Gloong_Quote --clear-static-content
php bin/magento setup:upgrade
php bin/magento cache:flush



Verify the fix

  • Reproduce the original scenario (e.g., address with no region or a region not required by that country).
  • Add a product to cart and proceed through checkout again.
  • The error should no longer appear, and checkout should complete.



Extra tips (optional but helpful)

  • Ensure Stores → Configuration → General → General → State Options match your selling countries (require region only where appropriate).
  • Confirm your address forms and integrations (ERPs, imports, custom checkout fields) supply a valid region when required.
  • Reindex after changes if needed:
  php bin/magento indexer:reindex



Reference to Magento core issue discussion:

https://github.com/magento/magento2/issues/7387

Updated on: 18/09/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!