Multi-Inventory assumes that a product with id=0 exists.
From a brief glance at the classes it looks like product 0 is being used as a template when creating variations?
(I came across the bug when trying to add variations to a product on a test site and having ajax.php hang on me with a 500)
Looking into the stack, I can see a whole whack of functions defaulting $product_id = 0
The problem? -> WP post_id's are not guaranteed to increment from 0 upward.
In my case, I imported the products from another site using the woo import options - as such there is no post 0 in the db. Hence the explosion upon adding a new variation.
I have been able to hack a quick fix by changing:
atum-multi-inventory/classes/Models/MainInventory.php:44
$product = AtumHelpers::get_atum_product( $this->product_id );
to
$product_id = (!($this->product_id) ? #some-know-product-id# : $this->product_id);
$product = AtumHelpers::get_atum_product( $product_id );
And, the same in:
atum-multi-inventory/classes/Models/Inventory.php:813
However would be grateful to see a proper fix as soon as possible as its a total showstopper.
Also, I'd love to hear if you think this bug is likely to resurface elsewhere when using multi-inventory with a db that does not contain a zeroth product.
Thankyou and blessings,
J