WooCommerce - excelling eCommerce
filter woocommerce_add_cart_item not working (1 post)

  1. Alan Cesarini
    Posted 2 years ago #


    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?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic