jeudi 28 janvier 2016

How to rewrite functions wordpress

In woocommerce plugin file class-wc-booking-cart-manager.php there is this code

/**
     * Constructor
     */
    public function __construct() {
        add_filter( 'woocommerce_add_cart_item', array( $this, 'add_cart_item' ), 10, 1 );
        }

/**
     * Adjust the price of the booking product based on booking properties
     *
     * @param mixed $cart_item
     * @return array cart item
     */
    public function add_cart_item( $cart_item ) {
        if ( ! empty( $cart_item['booking'] ) && ! empty( $cart_item['booking']['_cost'] ) ) {
            $cart_item['data']->set_price( $cart_item['booking']['_cost'] );
        }
        return $cart_item;
    }

I want to change add_cart_item function's code into my child theme functions.php file

Anyone knows how to do that ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire