How to override class WC_cart?

552 Views Asked by At

How to override class WC_cart in class-wc-cart.php ?

I trying:

function action_woocommerce_add_to_cart($qqqq) {
   if ( ! class_exists( 'WC_Cart_new' ) ) {

    class WC_Cart extends WC_Cart_new {
      //my function
     );
      $qqqq[] = new WC_Cart_new;

    } ;
    return $qqqq;
};
add_action( 'woocommerce_add_to_cart', 'action_woocommerce_add_to_cart');

But it does not work!

0

There are 0 best solutions below