Describe your bug or feature request.

Warning: Trying to access array offset on value of type null in Drupal\commerce_cart\Form\AddToCartForm->setFormDisplay() (line 206 of /home/mysite/public_html/modules/contrib/commerce/modules/cart/src/Form/AddToCartForm.php)

If a bug, provide steps to reproduce it from a clean install.

Believe this issue is related to PHP 7.4:

code at line 206:
if ($component['type'] === 'commerce_product_variation_attributes') {

modified code at line 206 and issue seems to be resolved:
if (isset($component['type']) && $component['type'] == 'commerce_product_variation_attributes') {

Not sure if this is the correct solution but "Trying to access array offset on value of type null" warnings are no longer displayed

CommentFileSizeAuthor
#2 3274438.patch695 bytesevaldas.uzkuras

Comments

miketsai created an issue. See original summary.

evaldas.uzkuras’s picture

Status: Active » Needs review
StatusFileSize
new695 bytes

To reproduce the issue you have to disable "Purchased entity" field for "Order item type's" form display mode "Add to cart".

jsacksick’s picture

Status: Needs review » Fixed

Committed, thank you for the fix!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.