Gateways where shopping carts are allowed give warnings for products with no weight

Created on 17 July 2023, over 1 year ago

Problem/Motivation

Gateways where shopping carts are allowed (f.e. Klarna) give warnings for products with no weight.

In src/Helpers/OrderHelper.php function getShoppingCartData variable $productWeight is declared (line 547 till 553). This can be NULL. At line 585 and 586 $productWeight is accessed as an array. If $productWeight is NULL then this will result in a warning on PHP 7.4 or higher.

Steps to reproduce

Use a gateway where shopping carts are allowed (f.e. Klarna) and buy a product without a weight.

Proposed resolution

A simple isset check before accessing the $productWeight variable will fix the warning.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

3.1

Component

Code

Created by

🇧🇪Belgium stefdewa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024