Is it possible to instantiate a new WC_Cart?

I am trying to use a different plugin’s functionality without letting it run normally. It has a function that uses a WC_Cart object, and I want to give it a cart that is completely spoofed. Absolutely not the standard WC()->cart.

I do not want to modify any plugins, and I want to keep my work inside the functions.php file.

Is it possible to make a new WC_Cart like this? How exactly can I do that?

Do I have to import the plugin file that contains the WC_Cart class? Or is it possible to access it without having to do that?

Read more here: Is it possible to instantiate a new WC_Cart?

Leave a Reply

Your email address will not be published. Required fields are marked *