Hi,
I'm trying to modify the price of a product before it is added to the cart. I'm using the filter 'woocommerce_add_cart_item', but I can't get it to work. Here's my code:
add_filter( 'woocommerce_add_cart_item', 'change_product_price_in_cart', 99, 1 );
function change_product_price_in_cart( $cart_data ) {
$cart_data[ 'data' ]->price = 999;
return $cart_data;
}
But in the cart all I see is the original price of the product. Am I missing something?