wpwham / multi-order-for-woocommerce

8 stars 2 forks source link

Add local variables as references to instances #1

Closed terence1990 closed 4 years ago

terence1990 commented 6 years ago

Thanks for this plugin! It's awesome.

I have a specific requirement where I need to add certain products to one order and certain products to another, splitting them in a custom way.

This can be achieved if I am able to unhook Alg_MOWC_Order_Manager::create_suborders_call_on_new_order from woocommerce_checkout_order_processed and extend Alg_MOWC_Order_Manager with a class in my theme and write the :create_suborders in the way that i need to.

Then i get to keep using all the other awesome functionality you have guys have written.

So to be able to that, all i need is a reference to the Alg_MOWC_Order_Manager instance; with this pull request I can access this instance via Alg_MOWC_Core::get_instance()->order_manager.

For good measure I have added a reference to all instances to keep it all consistent.