Home › Forums › WoodMart support forum › Change Select Option text to Buy now as soon as user selects the variation
Change Select Option text to Buy now as soon as user selects the variation
- This topic has 11 replies, 2 voices, and was last updated 2 years ago by Luke Nielsen.
-
AuthorPosts
-
November 15, 2022 at 3:40 pm #421279
siddharthParticipantDear Developers,
We are having an hard time in enabling this option…We want to change “Select Option” in sticky add to cart to clickable “Buy now” or any custom text as soon as user selects the variation. Currently in woodmart whenever the user clicks on select option he has to separately click on add to cart or buy now button inside the product page instead of directly clicking via sticky add to cart…(screenshot attached)
Is there’s any snippet available to do that in woodmart…Please help its should be recommended feature in woodmart.
- This topic was modified 2 years, 1 month ago by siddharth.
Attachments:
You must be logged in to view attached files.November 16, 2022 at 10:20 am #421494
Luke NielsenKeymasterHello,
You can change the “Select Option” text on any another through the Loco Translate plugin. Here is our documentation on how to use it:
https://xtemos.com/docs-topic/translate-woodmart-theme-with-loco-translate/
Thanks for your time and have a great day.
Kind Regards
November 17, 2022 at 9:09 am #421750
siddharthParticipantI don’t need translation of text i want to change the text to buy now as soon as user selects the variation and that should be clickable according to the variation selected
November 17, 2022 at 12:09 pm #421805
Luke NielsenKeymasterHello,
This plugin is not only for translation, it can help easily change any text and here is an example with the same button.
https://monosnap.com/file/UgHiYP3OfpTx9PgPLCdPBCdA8cb5fW
https://monosnap.com/file/zgO0F8lV54QiBO8Otlb3rimWdp6Kfb
Please let me know if such a way doesn’t fit you.
Kind Regards
November 17, 2022 at 4:33 pm #421875
siddharthParticipantCan’t we achieve the same thing without plugin?
- This reply was modified 2 years, 1 month ago by siddharth.
November 17, 2022 at 6:35 pm #421907
Luke NielsenKeymasterYep, paste the below code to the
functions.php
file in your child theme.use XTS\Modules\Quick_Buy\Main as Quick_Buy; if ( ! function_exists( 'woodmart_sticky_single_add_to_cart' ) ) { function woodmart_sticky_single_add_to_cart() { global $product; if ( ! woodmart_woocommerce_installed() || ! is_product() || ! woodmart_get_opt( 'single_sticky_add_to_cart' ) ) { return; } woodmart_enqueue_js_script( 'sticky-add-to-cart' ); woodmart_enqueue_inline_style( 'sticky-add-to-cart' ); if ( woodmart_get_opt( 'mobile_single_sticky_add_to_cart' ) ) { woodmart_enqueue_inline_style( 'woo-mod-quantity-overlap' ); } ?> <div class="wd-sticky-btn<?php echo woodmart_get_old_classes( ' woodmart-sticky-btn' ); ?>"> <div class="wd-sticky-btn-container container<?php echo woodmart_get_old_classes( ' woodmart-sticky-btn-container' ); ?>"> <div class="wd-sticky-btn-content<?php echo woodmart_get_old_classes( ' woodmart-sticky-btn-content' ); ?>"> <div class="wd-sticky-btn-thumbnail<?php echo woodmart_get_old_classes( ' woodmart-sticky-btn-thumbnail' ); ?>"> <?php echo woocommerce_get_product_thumbnail(); ?> </div> <div class="wd-sticky-btn-info<?php echo woodmart_get_old_classes( ' woodmart-sticky-btn-info' ); ?>"> <h4 class="wd-entities-title"><?php the_title(); ?></h4> <?php echo wc_get_rating_html( $product->get_average_rating() ); ?> </div> </div> <div class="wd-sticky-btn-cart<?php echo woodmart_get_old_classes( ' woodmart-sticky-btn-cart' ); ?>"> <span class="price"><?php echo wp_kses_post( $product->get_price_html() ); ?></span> <?php if ( $product->is_type( 'simple' ) ) : ?> <?php woocommerce_simple_add_to_cart(); ?> <?php else : ?> <a href="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="wd-sticky-add-to-cart button alt<?php echo woodmart_get_old_classes( ' woodmart-sticky-add-to-cart' ); ?>"> <?php echo true == $product->is_type( 'variable' ) ? esc_html__( 'Select options', 'woodmart' ) : $product->single_add_to_cart_text(); ?> </a> <?php Quick_Buy::get_instance()->output_quick_buy_button(); ?> <?php endif; ?> <?php do_action( 'woodmart_sticky_atc_actions' ); ?> </div> </div> </div> <?php } add_action( 'woodmart_before_wp_footer', 'woodmart_sticky_single_add_to_cart', 999 ); }
Do not forget to edit the “Select Options” field.
https://monosnap.com/file/cHgpg4R0sMF0jTZEeA9wZ2d0tCcaCQ
Kind Regards
- This reply was modified 2 years, 1 month ago by Luke Nielsen.
November 21, 2022 at 9:33 am #422399
siddharthParticipantThe above snippet is not working….after activating the above snippet..some website element(specially the one’s which created through elementor) disappeared and i have noticed that it had affected those elements which have animations enabled on page load….also the sticky add to cart disappears as well. So, please check
- This reply was modified 2 years, 1 month ago by siddharth.
November 22, 2022 at 11:05 am #422715
Luke NielsenKeymasterHello,
Kindly accept our sincere apologies for the inconvenience.
I have edited the above code and now it should work, please replace the old one with the above code and check the issue again.
Thanks for your patience. Hopefully, you are doing well.
Kind Regards
November 26, 2022 at 9:41 am #423973
siddharthParticipantThank you so much for helping me till now….no need to apologize and you have provided a good support till now.
That glitch gets fixed…except….when i click on variation the text doesn’t gets changed…the behavior remains same. I mean the sticky add to cart text changes on page load but i want to change it as soon as i choose variation and but the current situation is after adding above snippet that when i click on add to cart sticky button then it scrolls to variation section and when i select variation it the sticky add to cart text remains unclickable and doesn’t gets changed.
- This reply was modified 2 years ago by siddharth.
November 28, 2022 at 11:07 am #424272
Luke NielsenKeymasterHello,
May I request you make a video with the issue for a better understanding? Also please provide the access to the admin dashboard so we can check it on your side.
I look forward to hearing from you.
Kind Regards
December 5, 2022 at 8:30 am #426172
siddharthParticipantOk…will provide…please download the video in attachments…in this after applying your code…the variation text changes to “Choose options” but its gets changed on page load and also its not clickable but i want to change the sticky text as soon as user select any variation. If i click on choose options it gets scrolled me to the variation part which should not happen if the variation is selected. It should scroll to the variation part only when no variation is selected.
- This reply was modified 2 years ago by siddharth.
Attachments:
You must be logged in to view attached files.December 5, 2022 at 5:46 pm #426387
Luke NielsenKeymasterHello,
Sorry to say but right now there is no option in Theme Settings available for that. It’s the default behavior of the “Select Option” button in the sticky navbar. It requires Customization and this is beyond our limitations and support policy scope. Hope you can understand our limitations.
Kind Regards
-
AuthorPosts
Tagged: WoodMart, woodmart enhnancement, woodmart issue
- You must be logged in to create new topics. Login / Register