add_action(‘wp_enqueue_scripts’, function () {
if (!is_product()) return;

wp_add_inline_script(‘jquery-core’, ”
jQuery(function($){
function tweakWapfTotals(){
var $wrap = $(‘.wapf-product-totals’);

if(!$wrap.length) return;

// 1) Hide ‘Product total’ and ‘Options total’ rows
// (the amount spans carry these classes)
$wrap.find(‘.wapf-product-total, .wapf-options-total’)
.each(function(){
$(this).closest(‘div’).hide(); // hide the whole row

});

// 2) Rename ‘Grand total’ label to ‘Total’
// The amount span usually has class ‘wapf-grand-total’; the label is the first span in the same row.
$wrap.find(‘.wapf-grand-total’).each(function(){
var $row = $(this).closest(‘div’);
$row.find(‘> span’).first().text(‘Total’);
});

// Fallback: if labels aren’t classed, match by text safely
$wrap.find(‘.wapf–inner > div’).each(function(){
var $label = $(this).find(‘> span’).first();
var t = ($label.text() || ”).trim().toLowerCase();
if (t === ‘product total’ || t === ‘options total’) { $(this).hide(); }
if (t === ‘grand total’) { $label.text(‘Total’); }
});
}

// Run now…
tweakWapfTotals();

// …and re-run on qty/options/variation changes and DOM redraws
$(document).on(‘change keyup input’, ‘.quantity input.qty’, tweakWapfTotals);
$(document).on(‘found_variation hide_variation wc-product-addons-update’, tweakWapfTotals);

new MutationObserver(function(m){ tweakWapfTotals(); })
.observe(document.body, {childList:true, subtree:true});
});
“);
}, 10);