Home › Forums › WoodMart support forum › Buy Now plugin not compatible
Buy Now plugin not compatible
- This topic has 3 replies, 2 voices, and was last updated 5 years, 3 months ago by anatta.
-
AuthorPosts
-
September 10, 2019 at 3:22 pm #143002
anattaParticipantHi, I want to add a buy now button on product page, but this theme is not compatible with any of this 3 plugins, how to make it work ?
https://wordpress.org/plugins/woocommerce-quick-buy/
https://wordpress.org/plugins/add-to-cart-direct-checkout-for-woocommerce/
September 10, 2019 at 4:32 pm #143009
anattaParticipantHi, now I know why it does not compatible with https://wordpress.org/plugins/woocommerce-quick-buy/
I need to disable the AJAX add to cart, but I still want the Ajax add to cart function, just that when the Buy Now button is clicked, I would like to deactivate it via javascript, what is the javascript script variable switch for that ?
September 11, 2019 at 6:21 am #143076
Artem TemosKeymasterHi,
This option can be deactivated globally only and there is no custom snippet for this.
Kind Regards
September 11, 2019 at 6:46 am #143090
anattaParticipantIt’s possible with simple trick though, found the solution.
For anyone who has this issue, here is the solution.
Install this plugin,
https://wordpress.org/plugins/woocommerce-quick-buy/
Edit this file : wp-content/plugins/woocommerce-quick-buy/includes/js
/frontend.jsjust add this line into the file :
jQuery('body').off('submit');
so your modified file will become
jQuery(document).ready(function () { jQuery('.wcqb_button').click(function () { jQuery('body').off('submit'); var product_id = jQuery(this).attr('data-product-id'); var product_type = jQuery(this).attr('data-product-type'); var selected = jQuery('form.cart input#wc_quick_buy_hook_' + product_id); var productform = selected.parent(); productform.append('<input type="hidden" value="true" name="quick_buy" />'); var submit_btn = productform.find('[type="submit"]'); var is_disabled = submit_btn.is(':disabled'); if ( is_disabled ) { jQuery('html, body').animate({ scrollTop: submit_btn.offset().top - 200 }, 900); } else { productform.find('[type="submit"]').click(); } }); jQuery('form.cart').change(function () { var is_submit_disabled = jQuery(this).find('[type="submit"]').is(':disabled'); if ( is_submit_disabled ) { jQuery('.wcqb_button').attr('disabled', 'disable'); } else { jQuery('.wcqb_button').removeAttr('disabled'); } }) });
-
AuthorPosts
- You must be logged in to create new topics. Login / Register