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!