Woocommerce - display price in two currencies at the same time? - php

For legal reasons I'll soon have to display all prices in local currency + EUR at the same time.
I have WPML with multicurrency enabled, and I can set an exchange rate there. Problem is - it only works with currency switcher widget, and doesn't allow me to display both currencies at the same time (one under other). So, the other price is already calculated somewhere, but I don't know how to retrieve it and display it by adding something to functions.php of child theme.
Alternatively, there is no need to use WMPL Multicurrency here. Exchange rate is fixed, so it would be sufficient to just somehow divide the original price with fixed exchange rate and display it with other currency symbol. I'm aware that original price is already HTML formatted and contains the original currency symbol. Hence - no arithmetic operations can be used unless it's converted to number and currency symbol is stripped.
I've tried using this solution: Display prefixed price and additional unit price in Woocommerce simple products, but I end up with prices like this:
Original price: 99.00 $
Calculated price with fixed "exchange rate" entered in $unit_divider = 1.1;: 90.00 $ €
Note that here I managed to do the calculation and conversion, but I'm stuck with $ symbol.
P.S. I only need to display the price on product pages and archives - it's not necessary to have both currencies in cart and checkout (but it would be great to have that too!).
Thanks for help!

Related

How can I add a checkbox on a product page in WooCommerce that adds a fixed fee when checked?

Here is the trouble I'm having. I'm creating a custom kitchen cabinet doors and drawers website with Woocommerce. There are a lot of variations going into the project that alters the price (Wood type, thickness etc.) per square foot. The customer also has to provide credentials (L x W) to calculate the total cost of the product. We found that using the Measurement Price Calculator plugin works the best as it also calculated the weight of the product which can be used for shipping.
However, we want to add an option (preferably checkbox) that adds a fixed fee to the product if checked. Using WooCommerce itself and having "Boring" as a variable attribute doesn't work because adding a charge here will only add to the price per square foot and will not be fixed regardless of the dimensions.
I'm not a master at PHP and have only found ways to add a surcharge in the checkout but I need the fee to be conditional to the checkbox being checked and be replicated based on quantity. If there are any functions or hooks that you think could help me please let me know.
What you are looking for is a part of WooCommerce that was separated and turned into a paid plugin called WooCommerce Product Add-Ons.
Koda

Woocommerce - Add text after original price when on sale

I am trying to add the text "Highest reported price abroad" after the crossed-out original price on the single product page.
I attempted the method explained here: WooCommerce: How do you add text before the price and before sale price? However, the WooCommerce template seems to have changed significantly since then and I'm unsure how to modify the code given there to work with the new default template.
My client would like to have the "Highest reported price abroad" text be next to the crossed out regular price, but be able to style it separately from the price text. I have tried a plugin that allows adding text before the regular and sales prices, but it was then crossed out as well and couldn't be selected separately using CSS.

Incorrect shipping calculation in Magento

I have a Magento site which uses the webshopapps matrixrates plugin for shipping rates.
The shipping cost doesn't seem to be calculating correctly and appears to apply a discount to the product cost.
In the screenshot below, the basket contains one product that has a price of €30, the shipping option 'European Airmail' (€5.50) has been selected.
Therefore the total cost should be €35.50
However the cost comes out at €30.55.
It's almost as if the Delivery cost is subtracted from the total (ignoring euro cents)
Interestingly there are two instances of this site, the UK instance appears to work correctly but I can't find anything different in the config.
I've tried comparing a CSV export of shipping rates but can't see anything obviously different.
What do I need to do to get the cost to come out as the correct amount (€35.50)?
Any suggestions welcome!
EDIT
If I dump out the quote object, the price for the product shows up as 25
But if I just load the product and dump it's data, I get the actual price which is €30:
I've got the tax amount with:
<?php
$taxAmount = $quote->getShippingAddress()->getData('tax_amount');
?>
And that comes back as 0.000
So I'm at a bit of a loss as to what is going on here.
Got to the bottom of this, it was a catalogue price rule for free shipping upto 4.95..
I had removed all shopping cart price rules already but wasnt aware that anyone had created a catalogue price rule so didnt consider it. Thanks for the suggestions guys.

Handling multiple currencies in Magento

In Magento, we have multiple stores. Two of these stores share the same products but they have different prices. Store 1 uses Japanese Yen while Store 2 uses US Dollar. I'm using Japanese Yen as the base currency for both stores so that we don't need to input 2 prices, 1 for Yen and 1 for Dollar. I was able to convert all the prices in Store 2 frontend-wise to dollar by making some changes in the html code.
We use Paypal as the payment method. Since we use yen as the base currency the currency for Store 2 also displays as yen. I converted this also to dollar. Everything works well up to this point. The problem comes in when I go to the admin panel. Under Sales/Orders. I try to process the order and Invoice the specified order. The problem is, the order details now show 2 prices (1 in yen, 1 in dollar) like so:
Order Totals
Grand Total ¥21,200.00
[$218.36]
Total Paid ¥0.00
[$0.00]
Total Refunded ¥0.00
[$0.00]
So if I try to invoice the order, I end up with this error:
PayPal gateway has rejected request. Currency of capture must be the same as currency of authorization (#10613: Currency mismatch).
Is there anyway I can make Magento handle both currencies while the base currency is Japanese Yen?
As i know paypal is not accepting Yen directly there two alternative here i can suggest you to follow this two link and i am sure you will find solution depends on that
http://www.magentocommerce.com/boards/viewthread/270952/
follow this thread and may be you will get better idea,
however you can also go throw this Documentation to create some customization in model file to make it happen in your case
http://inchoo.net/ecommerce/magento/magento-checkout/magento-paypal-standard-how-to-pay-with-currency-other-than-base-one-and-do-it-in-your-language/
hope this will sure help you.

Magento featured products include tax

On my homepage for my shop I currently have a featured products area. The problem is it shows the price including the tax rate where throughout the site I've got it set up to display without the tax & then for the the tax to be added on within the cart.
I'm using the following code for my featured products pricing.
<p class="price">£<?php echo Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice(), 2);?>(+VAT)</p>
is there a simple way to force the outcome excluding tax as it seems to be ignoring my general settings?
It also seems to ignore the general rule for decimal places too. If I need to post the full code please just say.
The third parameter of Mage::helper('tax')->getPrice() function indicates if price have to be shown with or without tax. So either set it to null or just drop it.
For the rounding issue please try Mage::helper('core')->currency() instead of Mage::helper('tax')->getPrice(). So your final code should look like this:
echo Mage::helper('core')->currency($_product->getFinalPrice());

Categories