WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to remove classes from a plugin and add theme into to theme?

I need to modify Woocommerce WP_Checkout class but I want to move it to my theme folder so if woocommerce will be updated my changes will not be effected. Is theme some way to make an remove and add action/hook? Or maybe unhook page and add my custom page with the class?

Thanks in advance Patrick

share|improve this question

closed as unclear what you're asking by Pieter Goosen, Rarst May 31 '14 at 13:35

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

You cannot actually remove a class but you can override it. I think this tutorial may get you up and running. – Yogi Yang 007 Mar 23 '13 at 5:31
There are a ton of hooks/filters depending on what specfically you are trying to change in the WC_Checkout class. You could also try extending the class. – helgatheviking Mar 23 '13 at 8:20

The class WC_Checkout is assigned to a member of the class Woocommerce. So maybe something like this could work:

add_action( "plugins_loaded", "wpse_91273_custom_checkout", 999 );

function wpse_91273_custom_checkout()
    $GLOBALS['woocommerce']->checkout = new Custom_Checkout;
share|improve this answer
That didn't work. I tried to put above code in functions.php also included my new class and included exit; in new function. But the process still works. How can I see if it's replaced? – beitconsulting Mar 18 '13 at 8:14
Add die( __CLASS__ ); to one of the called methods. – toscho Mar 18 '13 at 9:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.