1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Totals fields
  1. Home
  2. Knowledge Base
  3. Product Page
  4. Totals fields
  1. Home
  2. Knowledge Base
  3. Pricing
  4. Totals fields
  1. Home
  2. Knowledge Base
  3. Front End
  4. Totals fields

Totals fields

By default, WooCommerce Product Add Ons Ultimate displays a set of subtotals showing the user how the total product price is arrived at.

However, if you prefer, you can either hide these subtotals altogether or just display the total cost of the product including the value of Product Add Ons fields.

To do this:

  • From the front end, go to Customizer > WooCommerce > WooCommerce Product Add Ons Ultimate
  • From the back end, go to WooCommerce > Settings > WooCommerce Product Add Ons Ultimate
Total only

From ‘Display totals fields’, choose whether to show or hide the subtotal breakdown, or just display the total price.

If you choose ‘Totals only’ and you want to add some text before the total, use this snippet:

<?php
function prefix_pewc_total_only_text( $label, $post_id ) {
return __( 'Total: ' );
}
add_filter( 'pewc_total_only_text', 'prefix_pewc_total_only_text', 10, 2 );

You can also add a snippet that will let you show / hide the totals fields depending on the product:

<?php
function demo_pewc_product_show_totals( $show_totals, $post_id ) {
// Show the Totals fields for product IDs in the array
$totals = array( 64, 66, 454 );
if( in_array( $post_id, $totals ) ) {
$show_totals = 'total';
}
// Hide the Totals fields for product IDs in this array
if( in_array( $post_id, array( 969, 1111 ) ) ) {
$show_totals = 'hide';
}
return $show_totals;
}
add_filter( 'pewc_product_show_totals', 'demo_pewc_product_show_totals', 10, 2 );

This is how to add a snippet.

Was this article helpful?

Need More Support?

If you can't find the answer that you're looking for, then please use the link below to raise a support ticket.
Contact Support

Related Articles