PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Get Price in PHP

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi, I'm trying to display the price AFTER conversion on the front end.

This is on the shop page to display the price per box but obviously it's just getting the value set in the back-end.

What I have is:

<div class="pppu-limit">
£
<span class="ppu-result">
<?php global
$woocommerce;
$y = get_post_meta( get_the_ID(), '_price', true);
$n = get_field("box_count" );
$number = ($y) / ($n);
$formattedNum = number_format($number, 2);
echo $formattedNum;
?>
</span>
<span>
/ box
</span>

Hello

Please read  this - https://currency-switcher.com/codex/#functions

To  convert  custom values - https://currency-switcher.com/shortcode/woocs_show_custom_price/

Hi, sorry I'm not sure what I'm looking for here. Which part of the codex am I looking at?

I just need the converted value instead of the Woocommerce price.

What would I put as the $y value?:
$y = get_post_meta( get_the_ID(), '_price', true);

Hello

Try  it  please

global $WOOCS;
$y = get_post_meta( get_the_ID(), '_price', true);
$res=$WOOCS->woocs_exchange_value($y);

Thanks Pablo but it's causing an error unfortunately. I tried:

<div class="pppu-limit">
£
<span class="ppu-result">
<?php global
$woocommerce;
$y = get_post_meta( get_the_ID(), '_price', true);
$res=$WOOCS->woocs_exchange_value($y);
$n = get_field("box_count" );
$number = ($res) / ($n);
$formattedNum = number_format($number, 2);
echo $formattedNum;
?>
</span>
<span>
/ box
</span>

Hello

Ok check  your  code - https://c2n.me/47VUgt7.png