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

Stock items creation not adjusted for multi vendor #182

Open
omairrazam opened this issue Apr 22, 2021 · 3 comments
Open

Stock items creation not adjusted for multi vendor #182

omairrazam opened this issue Apr 22, 2021 · 3 comments

Comments

@omairrazam
Copy link
Contributor

We need to make 2 adjustments which I think were missed.

  1. variant.rb
    method = create_stock_items
    issue = it loops on all stock locations which don't event belong to given vendor
    expected = only create stock items for respective vendor's stock location

  2. stock_location.rb
    method = create_stock_items
    issue = it loops on all variants of all vendor's.
    expected = only create stock item for respective vendor variants.

Overrall Impact faced:

i faced serious performance issue as number of vendors and products increased on my platform and I was able to find this as reason.

@giugrilli
Copy link

Same here, huge impact on vendor creation, heroku goes timeout

@damianlegawiec
Copy link
Contributor

@giugrilli @omairrazam this issue has been partially resolved in Spree 4.3 and Multi-Vendor 2.2. Further improvements will be done in Spree v5 which will include multi-vendor in Spree core.

@giugrilli
Copy link

giugrilli commented Nov 1, 2021

@damianlegawiec In the meantime I ended up just now doing this as a workaround, overriding the create_stock_location method.

`
Spree::Vendor.class_eval do

private

def create_stock_location
stock_location = stock_locations.where(name: name, country: Spree::Country.default).first_or_initialize
stock_location.propagate_all_variants = false
stock_location.save
end

end
`

The creation finalises correctly and fast.
Is this in your opinion a viable solution for the moment?

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

No branches or pull requests

3 participants