Home Forums WoodMart support forum Buy Now plugin not compatible

Buy Now plugin not compatible

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #143002

    anatta
    Participant

    Hi, 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/

    https://wordpress.org/plugins/buy-one-click-woocommerce/

    #143009

    anatta
    Participant

    Hi, 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 ?

    #143076

    Artem Temos
    Keymaster

    Hi,

    This option can be deactivated globally only and there is no custom snippet for this.

    Kind Regards

    #143090

    anatta
    Participant

    It’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.js

    just 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');
            }
        })
    });
Viewing 4 posts - 1 through 4 (of 4 total)