Reply 269164 to: Xstore theme Set Up

Avatar: Olga Barlow
Olga Barlow
Support staff
January 19, 2021 at 17:26

Hello,

Use the etheme_woocommerce_template_single_price hook to show it below the price, for example

function you_save_echo_product() {
	global $product;

	// works for Simple and Variable type
	$regular_price 	= get_post_meta( $product->get_id(), '_regular_price', true ); // 36.32
	$sale_price 	= get_post_meta( $product->get_id(), '_sale_price', true ); // 24.99
		
	if( !empty($sale_price) ) {
	
		$saved_amount 		= $regular_price - $sale_price;
		$currency_symbol 	= get_woocommerce_currency_symbol();

		$percentage = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 );
		?>
			<p class="you_save_price">You Save: <?php echo $currency_symbol .''. number_format($saved_amount, 2, '.', ''); ?></p>				
		<?php		
	} 
		
}
add_action( 'etheme_woocommerce_template_single_price', 'you_save_echo_product', 20 ); // hook number

Provide WP Dashboard access and link to the product with the sale schedule https://prnt.sc/x85p86 that does not show countdown https://prnt.sc/x85qpa . We’ll check why it does not work.

Regards

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.