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

[3.x]: Adding lots of shipping methods slows down fetching cart #3370

Closed
joostwaaijer opened this issue Jan 17, 2024 · 1 comment
Closed
Labels
commerce3 Issues related to Commerce v3 🐇 Performance

Comments

@joostwaaijer
Copy link
Contributor

What happened?

Description

For a customer we've imported over 750+ shipping methods. After these shipping methods were imported (Even when disabled) the duration of fetching the cart takes significantly more time, so page loads are also slowed down massively, after deleting these shipping methods, the page speed returned to normal. The imported shipping methods only used the standard shipping methods / rules. Please not that we have the option autoSetCartShippingMethodOption turned on, this probably affects the performance.

Digging some deeper into the code, I see that getAllShippingMethods from the ShippingMethods service are actually fetching all shipping methods, including disabled ones, I think this could actually use filter on enabled, otherwise create a new getAllEnabledShippingMethods and use that for automatically setting the shipping method.

Steps to reproduce

  1. Turn on autoSetCartShippingMethodOption in craft settings
  2. Add 750+ shipping methods
  3. Fetch cart on pages

Expected behavior

Fetching cart should not be impacted by disabled shipping method options.

Actual behavior

Fetching cart is negatively impacted by disabled shipping method options.

Craft CMS version

Craft Pro 3.9.10

Craft Commerce version

3.4.23

PHP version

8.3.1

Operating system and version

No response

Database type and version

Postgresql

Image driver and version

No response

Installed plugins and versions

@joostwaaijer joostwaaijer added commerce3 Issues related to Commerce v3 bug labels Jan 17, 2024
@lukeholder
Copy link
Member

lukeholder commented Oct 15, 2024

We recommend upgrading to Commerce 5 to get the many performance improvements that have been released since v3. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce3 Issues related to Commerce v3 🐇 Performance
Projects
None yet
Development

No branches or pull requests

2 participants