Save Woocomerce discount as percentage to database
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’] ) / … Read more