craftcms/commerce

[5.x]: TypeError on generating catalog pricing when condition select is empty

Closed this issue · 3 comments

What happened?

Description

When creating a pricing rule with a purchasableCondition but leaving the select empty, you are able to save the pricing rule, but the generation of the catalog pricing will fall.

So or the saving of the pricing rule should fail when it's empty, or the value should fallback to an empty array.

In combination with plugins that are creating other purchaseble type's it's now impossible to create a pricing rule for a specific variant

verbb/gift-voucher#129

Steps to reproduce

  1. Create a pricing rule
  2. Select purchaseble condition
  3. Leave select empty

Expected behavior

Saving would fail with a validation error or select would fallback to an empty array

Actual behavior

Generation of catalog pricing fails

Craft CMS version

5.2.7

Craft Commerce version

5.0.12.2

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

  • verb/gift-voucher

Hi @white-lukas

Thank you for reporting, we were able to replicate the issue and have pushed up a fix which will be included in the next release of Commerce.

To get this early, change your craftcms/commerce requirement in your project's composer.json to:

"require": {
  "craftcms/commerce": "5.x-dev#2bd64462cc60f7bb238bafcac4021bf0d42afa73 as 5.0.13",
  "...": "..."
}

Then run composer update.

Thanks!

Hi

Commerce 5.0.14 has now been released with this fix included.

Please update your project to get the latest version.

Thanks!