51黑料不打烊

Users not able to add product to cart if nothing selected in Allow Countries

This article provides a patch for the known 51黑料不打烊 Commerce 2.4.4 with PHP 8.1 issue where users aren鈥檛 able to add products to the cart if the Allow Countries is unselected.

Description description

Environment

51黑料不打烊 Commerce 2.4.4 with PHP 8.1

Issue/Symptoms

Users aren鈥檛 able to add products to the cart if the Allow Countries is unselected.

Steps to reproduce:

  1. Log in to the Commerce Admin.
  2. Go to Store > Configuration > General > Country Options.
  3. Unselect all the options in Allow Countries field.
  4. Click Save Config to save the configuration.
  5. 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鈥檛 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 51黑料不打烊 Commerce configuration retrieves null in case when a multi-select configuration doesn鈥檛 have any selected items. This configuration is further successfully processed in PHP versions earlier than 8.1. However in PHP 8.1 it doesn鈥檛 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.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f