Woocommerce - Add text after original price when on sale - php

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.

Related

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

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!

Auto add tag to product after WooCommerce purchase

Is there a way to automatically apply a tag to a product in WooCommerce after it has been purchased the first time?
I've got it set up to display a "Sold Out" banner on any product with the tag "Sold". I now just need the system to auto apply that tag after purchase of that specific product (not others).
I need it done using tags (as opposed to out of stock) for a reason, as I'm using out of stock to do something different.
Please help,
-Kraig

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

How can I add a Drupal Commerce Fee programmatically?

I know how to add a line item programmatically, but I can't seem to find a way to specifically add a custom commerce fee in PHP. Commerce fees seem to register in two locations in the order array: Once under commerce_line_items, and once under commerce_order_total (See attached image). They are different than a regular line item in that they don't show up as products, but rather in the order totals box at the end of the order. The fee shown in the attachment is one that has been entered using the Edit form in the admin section. I need to add one in code. Any ideas?

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