• Resolved 1callservice

    (@1callservice)


    3.0 update has broken my “woocommerce_before_calculate_totals” hook function, now everyone is able to buy things at a default $1 instead of my overrides from my own rules…

    add_action( 'woocommerce_before_calculate_totals', 'before_calculate_totals' );
    function before_calculate_totals( $_cart ){
        // loop through the cart_contents
        foreach ( $_cart->cart_contents as $cart_item_key => &$item ) {
            if($item['product_id']==507){
            	$eventMeta=get_post_custom($item['_eventID']);
    		$variationMeta=get_post_custom($item['variationID']);
    		  	
                	$item['data']->price = number_format($eventMeta["variation_".$item['variationID']."_price"][0],2,'.',',');
    	}elseif($item['product_id']==505){
    		$eventMeta=get_post_custom($item['_eventID']);
    	  	$variationMeta=get_post_custom($item['variationID']);
    	  	
    	  	if($item['agegroup']=="adult"){
    	  		$item['data']->price = number_format($eventMeta["variation_".$item['variationID']."_adultprice"][0],2,'.',',');
    		}elseif($item['agegroup']=="child"){
    	  		$item['data']->price = number_format($eventMeta["variation_".$item['variationID']."_childprice"][0],2,'.',',');
    		}
    	}
        }
    }

    it seems as though
    $item['data']->price = $someprice
    is no longer a valid method to override prices at the cart item level, where is the documentation on this? How do we override prices in this manner now on the 3.0 system?

    • This topic was modified 7 years, 11 months ago by 1callservice.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘price overrides broken’ is closed to new replies.