Reply 321504 to: add_action not showing up on product page

Avatar: Ruben Budding
Ruben Budding
Participant
April 7, 2022 at 09:13

`Thanks thats works! 🙂 If there are other users this on product page: Save now would like to have hereby the code below

//Save now: Price %Discount
function ts_you_save() {

global $product;

if( $product->is_type(‘simple’) || $product->is_type(‘external’) || $product->is_type(‘grouped’) ) {

$regular_price = get_post_meta( $product->get_id(), ‘_regular_price’, true );
$sale_price = get_post_meta( $product->get_id(), ‘_sale_price’, true );

if( !empty($sale_price) ) {

$amount_saved = $regular_price – $sale_price;
$currency_symbol = get_woocommerce_currency_symbol();
$percentage = round( ( ( $regular_price – $sale_price ) / $regular_price ) * 100 );
?>

Save now: €

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.