I need your help please.
In my Woocommerce Admin Product area under:
Product Data > General: I have created a “custom input field” under the “Sale price (€)” field.
In functions.php this field is called “_deposit_price”.
The “custom input field” contains a number (the deposit price), e.g.: 22.
This “_deposit_price” is only displayed for the customer’s information and is NOT actively deducted from the product price anywhere – it should simply be displayed as text information next to the product and in the product overview. It should also not be displayed in the shopping cart or at the checkout.
This is the last step in the function.php, which then outputs the content:
function c_deposit_price_display( $price ) {
global $post, $product;
if(get_post_meta( $post->ID, '_deposit_price', true )){
$dep_price = get_post_meta( $post->ID, '_deposit_price', true );
}
$price .= '<br/><span class="ctext">Your price with deposit '.$dep_price.'</span>';
return $price;
}
add_filter( 'woocommerce_get_price_html', 'c_deposit_price_display' );
…this works fine, but I now have the following problems:
1.) I am using the woopayments multi-currency converter and of course it does not recognise my custom field “_deposit_price” as a price – so it is not converted to the selected currency. How can I get my “_deposit_price” custom field to be recognised as a price and automatically converted into different currencies?
2) How do I get the currency symbol behind my “_deposit_price” custom field to change with the selected currency?
Many thanks for your help in advance!
Best regards, Benjamin
I have tried with various attempts with the $sale_price and $regular_price, but they really change the price in the shopping basket – I also tried with a calculation, but I couldn’t get it to work either
Mercury is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.