Support » Plugins » Woocommerce Tweak Classes With Filters and Hooks

  • I’m developing a woocommerce custom extension to a customer requested me with some functionallities.

    I need override some functions inside the class_wc_order.php file, but i don’t want edit the file directly, i want do it through an extension or well as function in the theme.

    This is the idea:

    require_once(ABSPATH .’wp-content/plugins/woocommerce/classes/class-wc-order.php’);

    class WC_Order_Custom extends WC_Order{

    public function __construct( $id = ” ) {
    parent::__construct( $id = ” );

    public function reduce_order_stock(){
    // code goes here


    My intention is, use the reduce_order_stock function that i created instead the original, at the moment to generate the orders, but i’m stucked there, i need figure out it soon.
    How can i do it with filters and actions?

    Thankyou for your help and time.

Viewing 1 replies (of 1 total)
  • Finally i found the answer, i didn’t need replace the function, just add another new after the reduce stock function with the hook, reduce_order_stock action.

    By the way, thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce Tweak Classes With Filters and Hooks’ is closed to new replies.