PHP Code for “SAVE” in product page
-
Hi guys, i put php snipped code in my store but i have problem and need help.
The code show the symbol and the amount like this “You save: $20” but in my country the symbol is over the number like this “You save: 20 PLN”
Just need to replace the value of this code but i don’t know how i try everything.
function you_save_text_for_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( ‘woocommerce_single_product_summary’, ‘you_save_text_for_product’, 12 ); // hook priority
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Code for “SAVE” in product page’ is closed to new replies.