• Resolved podrskaorvelus

    (@podrskaorvelus)


    Hello, I would like to show the saved amount on sale products. Here is the code that I’m using, but my currency is now showing, only the saved amount. Any ideas how to fix it? Thanks in advance!

    function usteda_popust() {
    
    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();
    ?>
    <p style="font-size:18px;color:red;">U?teda: <?php echo number_format($amount_saved,2, ',', '') ?></p>
    <?php
    }
    }
    }
    
    add_action( 'woocommerce_single_product_summary', 'usteda_popust', 11 );

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WooCommerce saved amount’ is closed to new replies.