1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Field Types
  5. Calculations
  6. Add/show currency symbol on calculation fields in the cart
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Cart
  5. Add/show currency symbol on calculation fields in the cart
  1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Add/show currency symbol on calculation fields in the cart

Add/show currency symbol on calculation fields in the cart

By default, the calculation, and number field values don’t have a currency symbol in the cart/cart page. If you’d like the values to have your set currency symbol, then here’s a snippet you can use:

<?php
/** Add the default currency field to calculation values in cart **/
add_filter( 'pewc_filter_item_value_in_cart', function( $field_value, $field ) {
if ( $field['type'] == "calculation" ) {
$field_value = get_woocommerce_currency_symbol() . $field_value;
}
return $field_value;
}, 10, 2 );

Here’s how to add your snippet: How to add a code snippet to your site

Was this article helpful?

Related Articles