-
AuthorPosts
-
August 16, 2016 at 12:04 pm #673143
Hey,
As a lot of people, I have the problem that, when I use the avia builder on a woocommerce single product page, I can use the “Product Purchase Button”, but it does not display the product price.
Now, I tried the woocommerce shortcode, but it outputs a purchase button that looks kinda misaligned. Also, whit this one I cannot edit quantity needed. (see image – the upper part is the avia element, lower part the shortcode output)
Principally, I very much prefer the purchase button style that the avia builder element gives me, but why did you guys not include price with it? Or at least an option to have a price displayed if wanted? …I mean, its a shop. Why the heck leave out the prices?!
Anyway, I don’t wanna end up having to update all the prices on my product pages manually at times when I offer a discount or something.So my questions are:
– Meanwhile, have there appeared any solutions for the problem with the avia add-to-cart-button element?
– If not, can you tell me how to fix the button that the woocommerce shortcode gives me? Essentially, I want it to look and behave exactly as the one from the avia element, but also displaying the current price.- This topic was modified 8 years, 4 months ago by Robert.
August 18, 2016 at 1:31 pm #674162….hello? …anybody? =D
August 20, 2016 at 6:47 am #674936Hi,
The
avia_sc_produc_button
shortcode is just a wrapper for a WooCommerce function, which only shows an add-to-cart button, one thing you could use is a price shortcode, you can add this to your functions.php:function wc_price_func( ) { $html = ''; if( function_exists( 'wc_get_product' ) ){ $_product = wc_get_product( get_the_ID() ); $html = $_product->get_price(); } return $html; } add_shortcode( 'woocommerce_price', 'wc_price_func' );
Usage:
[woocommerce_price]
Best regards,
JosueAugust 21, 2016 at 3:38 pm #675353Thanks!!
This is what I’ve been looking for.
However, there’s one more small thing: I don’t know php, but I assume $html is the variable that returns the price? Can you add a line that replaces the decimal separator “.” in the string with a “,”? The shop is in Germany.August 21, 2016 at 4:27 pm #675364Hi,
Sure:
function wc_price_func( ) { $html = ''; if( function_exists( 'wc_get_product' ) ){ $_product = wc_get_product( get_the_ID() ); $html = str_replace('.',',',$_product->get_price()); } return $html; } add_shortcode( 'woocommerce_price', 'wc_price_func' );
Best regards,
Josue- This reply was modified 8 years, 4 months ago by Josue.
August 23, 2016 at 4:12 am #676137Thanks a lot!
Problems solved, topic closed.August 24, 2016 at 6:11 am #676792 -
AuthorPosts
- The topic ‘"Add to cart" button shortcode problem’ is closed to new replies.