Move A Product Between Companies In Mve

I'm trying to do an "product and inventory transfer" within MVE. The Warehouse addon is installed. What I do effectively is to clone the product in the originating company via fn_clone_product($original_product_id), then adjust some things like amount=0, product, seo-name, etc. and set the company_Id to the new company and do an fn_update_product($new_product_id).

After that, I do a fn_adjust_product_amount() to increase the product quantity by an amount. But since this product_id is tied to a warehouse in the old company, it is failing and causing an stopage of the php processing due to an undefined warehouse.

So my question is, what do I need to do to "detach" the cloned product from the warehouse in the original company, then after I change the company_id, attach it to the first warehouse in the new company before calling fn_adjust_product_amount(). So seems I need 2 functions:


But the Warehouse addon is not documented and digging through the layers of classes to figure it out would take me days. So hoping someone has some experience with it. I know cs-cart won't help me.

This is the B2B side of an MVE site so when other sellers purchase from sellers on the platform, we want to offer a "transfer" of the product and the purchased quantity to the new store.