Title: override function
Last modified: August 21, 2016

---

# override function

 *  [easyp](https://wordpress.org/support/users/easyp/)
 * (@easyp)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/override-function-1/)
 * I’d like to override a function in woocommerce, specifically –
    woocommerce/includes/
   wc-cart-functions.php (the wc_cart_totals_order_total_html function).
 * I could edit the function directly (it outputs html that needs to be changed),
   but I’d prefer not to as I’ll lose changes on updates.
 * I’m sure it’s a common thing, I’m just not quite sure how to go about doing that.
   If I copy the function to functions.php in my theme, I get an error about re-
   declaring the function.
 * thanks.
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/override-function-1/#post-5155550)
 * If you have a [child theme](http://codex.wordpress.org/Child_Themes), you can
   copy the relevant file to your child theme and rewrite the copy. The copy will
   be used in preference to the WooCommerce version.
 *  Thread Starter [easyp](https://wordpress.org/support/users/easyp/)
 * (@easyp)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/override-function-1/#post-5155610)
 * thanks. I tried doing that, and it works if you are overriding files within woocommerce/
   templates but not wocommerce/includes.
 * any other thoughts?
 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/override-function-1/#post-5155670)
 * Thanks for the correction!
 * There’s a redefine function in the [pecl runkit extension](http://uk1.php.net/runkit_function_redefine)
   if you have access to your php environment, but that seems like hard work for
   this application.
 * Depending on exactly what you want to do, there’s the possibility of just letting
   the function do its thing and then changing content with css using the [content property](http://www.w3schools.com/cssref/pr_gen_content.asp).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘override function’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/override-function-1/#post-5155670)
 * Status: not resolved