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]: Cannot update Shipping Rule Conditions #3851

Open
bjerringgaard opened this issue Jan 15, 2025 · 6 comments
Open

[5.x]: Cannot update Shipping Rule Conditions #3851

bjerringgaard opened this issue Jan 15, 2025 · 6 comments

Comments

@bjerringgaard
Copy link

What happened?

On the newest version of Craft Commerce, nothing is updated when trying to create shipping rule category conditions
In the logs i get the following error:
Exception 'Error' with message 'Typed property craft\commerce\models\ShippingRuleCategory::$shippingRuleId must not be accessed before initialization'

Craft CMS version

5.5.9

Craft Commerce version

5.2.11

PHP version

8.2.26

Operating system and version

MacOs, project running in DDEV

Database type and version

mysql:8.0

Image driver and version

No response

Installed plugins and versions

Copy link

linear bot commented Jan 15, 2025

@nfourtythree
Copy link
Contributor

Hi @bjerringgaard

Thank you for your message. Could you please gives us some steps to recreate this issue.

Here is a video of me creating a new shipping method and shipping rule and not coming up against any errors.

CleanShot.2025-01-20.at.07.59.03.mp4

With the steps you provide we will be able to look into this further.

Thanks!

@nfourtythree nfourtythree self-assigned this Jan 20, 2025
@nfourtythree
Copy link
Contributor

Hi @bjerringgaard

We are going to close this issue for now as it seems to have gone stale.

If you are able to provide repeatable steps to get this error, please detail them in a comment and we can reopen the issue and investigate it further.

Thanks!

@bjerringgaard
Copy link
Author

Hi again. Sorry for the long response.

I have since tested on a new setup without the issue.
This particular problem happend while updating a craft4 site, to craft5, where the shop was converted to using multistore.

I managed to fix it though the database.
Its seems like the issue is related to the shippingrule categories only being fetched from the primary store.

The issue still persists, as i cant create ned shipping methods without having to update them though the database.
But since i cant reproduce it on a demo setup, i don't really know how to proceed from here.

@lukeholder
Copy link
Member

@bjerringgaard Send your database backup, compose.json and composer.lock to [email protected] with a reference to this ticket and steps to reproduce on your installation and we can take a look. Thanks!

@lukeholder
Copy link
Member

lukeholder commented Feb 21, 2025

Thanks for reporting this. I have a fix in PR that will be included in the next release once merged.

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

"require": {
  "craftcms/commerce": "dev-feature/pt-2388-5x-cannot-update-shipping-rule-conditions as 5.3.3",
  "...": "..."
}

Then run composer update.

We will update this ticket once the release is out.

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