- First commit to issue fork.
- 🇩🇪Germany ktpm
Hi guy_schneerson,
I think commerce_stock_enforcement_get_context() should be moved to the context creator trait as it (presumably) always returns a store where the current implementation does not.
This can result in an error page if we assume to have stores A, B and C, where A is the default store, a product has selected B and C, and then you try to edit a product variation.
Using the SelectStoreTrait saves a few lines of code but requires a try/catch. Please check my approach in the MR.
- 🇬🇧United Kingdom chrisscrumping
I have been running into exactly the issue described by ktpm, should we re open this ticket?
My main issue is; once I create a product, if I try moving it to other stores eg create product in store A and later move it to Store B and C (note it has to be > 1 store) I can no longer edit the product variations.
There is an issue with the patch/diff as the SelectStoreTrait requires $this->currentStore so we need to set this first.
I have added the below to the top of the getContextDetails
/** @var \Drupal\commerce_store\CurrentStore $currentStore */ $this->currentStore = \Drupal::service('commerce_store.current_store'); $store = $this->currentStore->getStore();
This seems to fix the issue I was having in that I can edit the product variations. My hunch is this may have other implications for stock and order management because its just selecting the first store in the array, although I can't see what else we can do?
- 🇬🇧United Kingdom guy_schneerson
OK, it looks like it needs some work :) will have a look