Get product price in a different currency using WooCommerce Currency Switcher

Question

I am working on some costume products pages in wordpress and I am having kinda of an issue when outputting the product price, the deal is that I am using a plugin to switch the currency and because I have made a lot template changes I had to go with the normal loop way to output products:

foreach($items as $item => $values) { 
        $_product =  wc_get_product( $values['data']->get_id() );
        //product image
        $getProductDetail = wc_get_product( $values['product_id'] );
        //echo "<b>".$_product->get_title() .'</b>  <br> Quantity: '.$values['quantity'].'<br>'; 
        //$price = get_post_meta($values['product_id'] , '_price', true);
        $price = $_product->get_price();}

The thing is that I can’t change the product’s price from the default to price to the currency I chosen.
In other hand if I use

$woocommerce->cart->get_cart_total();

it shows me the total in the cart with the currency I picked.
Is there anything similar to this for a single product? or a list of products.

0
Mimo_dz 2 months 0 Answers 12 views 0

Leave an answer