eagleagency(@eagleagency)
4 Posts
Customers
Quote from eagleagency on June 5, 2020, 15:02
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>
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>
Pablo Borysenco(@pavlo_borysenco)
29,363 Posts
Quote from Pablo Borysenco on June 8, 2020, 09:59
Hello
Please read this - https://currency-switcher.com/codex/#functions
To convert custom values - https://currency-switcher.com/shortcode/woocs_show_custom_price/
Hello
Please read this - https://currency-switcher.com/codex/#functions
To convert custom values - https://currency-switcher.com/shortcode/woocs_show_custom_price/
eagleagency(@eagleagency)
4 PostsTopic Author
Customers
Quote from eagleagency on June 8, 2020, 13:09
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);
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);
Pablo Borysenco(@pavlo_borysenco)
29,363 Posts
Quote from Pablo Borysenco on June 9, 2020, 10:15
Hello
Try it please
global $WOOCS;
$y = get_post_meta( get_the_ID(), '_price', true);
$res=$WOOCS->woocs_exchange_value($y);
Hello
Try it please
global $WOOCS;
$y = get_post_meta( get_the_ID(), '_price', true);
$res=$WOOCS->woocs_exchange_value($y);
eagleagency(@eagleagency)
4 PostsTopic Author
Customers
Quote from eagleagency on June 9, 2020, 12:05
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>
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>
Pablo Borysenco(@pavlo_borysenco)
29,363 Posts
Quote from Pablo Borysenco on June 10, 2020, 11:38
Hello
Ok check your code - https://c2n.me/47VUgt7.png
Hello
Ok check your code - https://c2n.me/47VUgt7.png