jeudi 28 janvier 2016

Override plugin function Woocommerce

I want to override this function from class-wc-booking-cart-manager.php to my child theme functions.php :

/**
 * 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;
}

When I comment $cart_item['data']->set_price( $cart_item['booking']['_cost'] ); It works.

But I want to do the same thing into my child theme functions.php file. I don't know how to override this one.

Thanks for your help !



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire