1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Advanced Topics for Add-Ons Ultimate
  5. Cart and Order
  6. Hide calculation value (not price) in the cart
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Hide calculation value (not price) in the cart

Hide calculation value (not price) in the cart

If your calculation field is used to set or display as a price, you might want to hide the value in the cart meta and just display the price.

To do so, you can use this snippet:

<?php
/**
* Remove calculation field value (not price) from cart
*/
function prefix_remove_calculation_value( $value, $item ) {
if( $item['type'] == 'calculation' ) {
$value = '';
}
return $value;
}
add_filter( 'pewc_filter_item_value_in_cart', 'prefix_remove_calculation_value', 10, 2 );

Here’s how to add the snippet.

Was this article helpful?

Related Articles