With thanks to stillatmylinux for the steer.
Here’s the code I used in the end should anyone need something similar
// Woocommerce Percentage Saved
function percentager_shortcode($atts)
{
// override default attributes with user attributes
$percentager_atts = shortcode_atts([
'reg' => '500',
'sale' => '200'
], $atts);
$added_up = round( ( ( $percentager_atts['reg'] - $percentager_atts['sale'] ) / $percentager_atts['reg'] ) * 100 );
// start output
$o = '';
// Words
$o .= esc_html__($added_up, 'percentager') . '% Off';
// return output
return $o;
}
function percentager_shortcodes_init()
{
add_shortcode('percentager', 'percentager_shortcode');
}
add_action('init', 'percentager_shortcodes_init');
Then the shortcode used in Revolution slider:
[percentager reg=”{{meta:_regular_price}}” sale=”{{meta:_sale_price}}”]