Home Forums WoodMart support forum Display amount money saved

Display amount money saved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #170487

    mallethenao
    Participant

    Hello, is possible display the amount of money saved in the product page?

    Something like:

    https://yithemes.com/blog/tutorials/woocommerce-display-the-amount-of-money-saved-on-discounted-items/

    #170494

    Hello,

    Yes, there is the option. First of all, you need to create sales products, you can find brief instruction here: https://xtemos.com/docs/woodmart/faq-guides/product-grid-carousel-element/

    Then you can configure the labels in the Theme Settings > Shop > Product labels.

    Best Regards

    #170497

    mallethenao
    Participant

    Hello, but it doesn’t was the that I asked, I want show to message “Now Save x price” not a label, I attached a example.

    Attachments:
    You must be logged in to view attached files.
    #170540

    Hello,

    Woocoommerce does not provide such an option, you will have to find a plugin.

    Best Regards

    #170670

    mallethenao
    Participant

    I founded the next code, but it doesn’t work, the “woocommerce_single_product_summary” is the name of function? I can use it with variable products.

    // Add save amount next to sale item prices.
    function you_save_echo_product() {
    	global $product;
    
    	// works for Simple and Variable type
    	$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) ) {
    	
    		$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( 'woocommerce_single_product_summary', 'you_save_echo_product', 11 );
    #170701

    Hello,

    We have not tested the code and do not guarantee it would work. Such customization is out of our support scope, try to find a plugin or developer who would provide the valid code.

    Best Regards

Viewing 6 posts - 1 through 6 (of 6 total)