I have the following code to generate custom prices:
add_action( 'woocommerce_before_calculate_totals', 'update_custom_price', 1, 1 );
function update_custom_price( $cart_object ) {
foreach ( $cart_object->cart_contents as $cart_item_key => $value ) {
$price = my_custom_calculate_func($value);
$value['data']->set_price($price);
}
}
It works great on the cart page, but on the WooCommerce mini cart widget, it doesn't display the correct price but does calculate the proper sub-total.
I believe the code for this exists as a template, so I have copied the file from ../wp-content/plugins/woocommerce/templates/cart/mini-cart.php to ../wp-content/mytheme/woocommerce/cart/mini-cart.php but changing this file does nothing. I have deleted everything in this file and it stays the same.
Any guidance appreciated.