Users not able to add product to cart if nothing selected in Allow Countries
This article provides a patch for the known ÃÛ¶¹ÊÓÆµ Commerce 2.4.4 with PHP 8.1 issue where users aren’t able to add products to the cart if the Allow Countries is unselected.
Description description
Environment
ÃÛ¶¹ÊÓÆµ Commerce 2.4.4 with PHP 8.1
Issue/Symptoms
Users aren’t able to add products to the cart if the Allow Countries is unselected.
Steps to reproduce:
- Log in to the Commerce Admin.
- Go to Store
>
Configuration>
General>
Country Options. - Unselect all the options in Allow Countries field.
- Click Save Config to save the configuration.
- Go to the storefront and try adding a product to the cart.
Expected Result:
You are able to add a product to the cart.
Actual Result:
You aren’t able to add a product to the cart. You get the following console error:
Failed to load resource: the server responded with a status of 400 (Bad Request)
customer-data.js:87 Uncaught Error: [ object Object]
at Object.<anonymous> (customer-data.js:87:23)
at fire (jquery.js:3500:50)
at Object.fireWith [ as rejectWith] (jquery.js:3630:29)
at done (jquery.js:9798:30)
at XMLHttpRequest.<anonymous> (jquery.js:10057:37)
Cause
The ÃÛ¶¹ÊÓÆµ Commerce configuration retrieves null
in case when a multi-select configuration doesn’t have any selected items. This configuration is further successfully processed in PHP versions earlier than 8.1. However in PHP 8.1 it doesn’t work properly due to the errors that are caused by the .
Resolution resolution
Solution
To resolve the issue, apply the following patch:
How to apply the patch
³§±ð±ðÌýApply patches in the Commerce on Cloud Guide for instructions.