What happened?
Description
Getting the following error when calling toArray() on a custom line item:
yii\base\InvalidConfigException: Cannot get a purchasable for a custom line item in /var/www/html/vendor/craftcms/commerce/src/models/LineItem.php:838
Steps to reproduce
- Create a custom line item object.
- Call
toArray() on the line item object.
Expected behavior
Return a serialized representation of the custom line item object.
Actual behavior
Throws an InvalidConfigException.
Craft CMS version
Craft Pro 5.10.10
Craft Commerce version
5.6.7
PHP version
8.2.30
Operating system and version
Linux 6.12.76-linuxkit
Database type and version
PostgreSQL 14.20
Image driver and version
Imagick 3.8.1 (ImageMagick 7.1.1-43)
Installed plugins and versions
No response
What happened?
Description
Getting the following error when calling
toArray()on a custom line item:yii\base\InvalidConfigException: Cannot get a purchasable for a custom line item in /var/www/html/vendor/craftcms/commerce/src/models/LineItem.php:838Steps to reproduce
toArray()on the line item object.Expected behavior
Return a serialized representation of the custom line item object.
Actual behavior
Throws an InvalidConfigException.
Craft CMS version
Craft Pro 5.10.10
Craft Commerce version
5.6.7
PHP version
8.2.30
Operating system and version
Linux 6.12.76-linuxkit
Database type and version
PostgreSQL 14.20
Image driver and version
Imagick 3.8.1 (ImageMagick 7.1.1-43)
Installed plugins and versions
No response