Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: TypeError triggered when adding discount condition #3538

Closed
TheFunkyMonk opened this issue Jun 10, 2024 · 3 comments
Closed

[5.x]: TypeError triggered when adding discount condition #3538

TheFunkyMonk opened this issue Jun 10, 2024 · 3 comments

Comments

@TheFunkyMonk
Copy link

What happened?

Description

When creating a discount for a condition where the cart contains 6 or more items, saving the discount triggers the following error:

craft\commerce\services\Stores::getStoreById(): Argument #1 ($id) must be of type int, null given

2024-06-10 at 15 20 04

Steps to reproduce

  1. Create a new discount under Store Management > Discounts
  2. Set the Match Order rule to Total Qty > is greater than or equals > 6

Expected behavior

Discount can be saved

Actual behavior

TypeError displays

Craft CMS version

5.1.10

Craft Commerce version

5.0.9

PHP version

8.2.19

Operating system and version

Linux 6.5.0-15-generic

Database type and version

MySQL 8.0.33

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

CKEditor 4.0.6
Colour Swatches 5.0.0
Control Panel CSS 3.0.0
Craft Commerce 5.0.9
Default Dashboard 3.0.0
Field Manager 4.0.0
Guide 4.0.0-beta.1
ImageOptimize 5.0.1
Image Resizer 4.0.0
Neo 5.0.2
No-Cache 3.0.2
PayPal Checkout for Craft Commerce 3.0.0
Redirects 5.0.0
Retcon 3.1.0
SEO 5.0.3
Servd Assets and Helpers 4.0.3
Stripe for Craft Commerce 5.0.1

Copy link

linear bot commented Jun 10, 2024

@lukeholder lukeholder self-assigned this Jun 11, 2024
@lukeholder
Copy link
Member

Thanks for reporting this issue. We have fixed it for the next release.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "5.x-dev#08bce9de597355ec34e5c602c639a2ddaa0b9d54 as 5.0.9",
  "...": "..."
}

Then run composer update.

We will update this ticket once the release it out. Thanks again.

@nfourtythree
Copy link
Contributor

Commerce 5.0.10 has now been released with this fix included.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants