[Resolved] Shortcode for displaying price of product not working as it should
This thread is resolved. Here is a description of the problem and solution.
Problem:
Shortcode for displaying price of product not working as it should
Solution:
If you want to display the WooCommerce Views price filed "views_woo_price", please make sure that you run the batch update manually once to calculate and update the price field value.
I am trying to: Diplay two different prices (€ 75 and € 15) on one page
Link to a page where the issue can be seen: homepage (but now in maintenance mode, so I am including screenshots)
I expected to see: the correct prices (€ 75 and € 15)
Instead, I got: twice € 75.
Also when the shortcode for the second product (id 2400) is tried on another page, I still get the price of the first product (id 2262) which is € 75.
Finally, I would like to have a way to display the euro sign in front of the price.
Thanks for the quick reply. Unfortunately when testing this, using "id=" made no difference. Also, when I asked for a way to display the euro, I really meant a way to display the currency. This could be euro, but it could also be dollar or pound or whatever. Therefore "hardcoding" a sign is unfortunately not an option.
Well - can I have problem URL where you are trying to display the price and currency symbol with access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Well - When I visited the products with IDs 2262 and 2400 and when I check the views_woo_price field for both product the value was same 75. Then I go to WooCommerce Views and udpated the batch manually to calculate the fields.
To display currency symbol I've added following shortcode to your current theme's functions.php file.
function func_show_currency_symbol( $atts ){
// Get the country name:
return get_woocommerce_currency_symbol();
}
add_shortcode( 'show_currency_symbol', 'func_show_currency_symbol' );
And displayed withing your sidebar widget as given under:
[show_currency_symbol]
I can see its working now here: hidden link
As we covered your original issues reported with this ticket, I would kindly urge you to create a new ticket with your each new question. This will help other users searching on the forum. However - for displaying translated price for each language please contact WPML support.