Tagged: Nikko
-
AuthorPosts
-
November 3, 2016 at 6:42 pm #707901
Hi want to add a phone number to every product after the buy button on the single product page in a Woocommerce store. Where do I start?
ThanksNovember 5, 2016 at 10:15 am #708650Hey fanlokbun,
Try to add this code in functions.php:
add_action( 'woocommerce_after_add_to_cart_button', 'addtocart_button_func' ); function addtocart_button_func() { echo '<div class="my_phone_number">XXX-XXXX</div>'; }
Just replace XXX-XXXX with your phone number. Let us know if it works :)
Best regards,
Nikko- This reply was modified 8 years, 1 month ago by Nikko.
November 5, 2016 at 1:40 pm #708685Hi Nikko,
I get this error:Parse error: syntax error, unexpected ‘addtocart_button_func’ (T_STRING), expecting ‘(‘ in /home/fordtrac/public_html/fordtractorsales.co.uk/wp-content/themes/orion-theme/functions.php on line 17
This is line 17:
function add_content_after addtocart_button_func() {
Thanks for your help
RobNovember 6, 2016 at 5:26 pm #708885Hi,
Sorry about that, I have fixed the code I have given above, can you try to check it out.
Best regards,
NikkoNovember 7, 2016 at 11:36 am #709114Hi Nikko,
It hasn’t worked but I think it is because I don’t have an add to cart button now. I have replaced it with “Request a Quote” button. this is the div:<div class="yith-ywraq-add-to-quote add-to-quote-2718"> <div class="yith-ywraq-add-button show" style="display:block"> <a href="#" class="add-request-quote-button button" data-product_id="2718" data-wp_nonce="17c79cf36a"> Add to quote</a> <img src="http://fordtractorsales.co.uk/wp-content/plugins/yith-woocommerce-request-a-quote/assets/images/wpspin_light.gif" class="ajax-loading" alt="loading" style="visibility:hidden" width="16" height="16"> </div> </div>
If you could adjust the code for me I would be most grateful. I don’t want to break anything.
Thanks
RobNovember 7, 2016 at 3:57 pm #709312Hi,
Yes, it wouldn’t work since Add to Quote removes the Add to Cart button. Are you using the pro or free version of Yith Add to Quote plugin?
Best regards,
NikkoNovember 7, 2016 at 4:02 pm #709319Free at the moment. The client may want to upgrade it later.
Thanks
RobNovember 9, 2016 at 5:10 am #710029Hi,
Try to change the code I gave you to this one:
add_action( 'woocommerce_single_product_summary', 'add_phone', 36 ); function add_phone() { echo '<div class="my_phone_number">XXX-XXXX</div>'; }
To style it, just add this to Quick CSS (located in Enfold > General Styling):
.my_phone_number { display: inline-block; font-size: 20px; padding: 0 20px; }
Just change the values as you see fit. Let us know if it works :)
Best regards,
NikkoNovember 9, 2016 at 4:28 pm #710298Perfect!
Many thanks NikkoNovember 10, 2016 at 4:24 am #710514Hi,
Glad we could help!
We really appreciate it if you rate our theme on themeforest https://themeforest.net/downloads
To know more about enfold features please check – http://kriesi.at/documentation/enfold/
Thank you for using Enfold :)Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.