Plugin Author
taisho
(@taisho)
Hello,
what was the last version when the plugin worked correctly for you? Does the 500 error (network tab in Chrome dev tools) on the page load appear when the plugin is deactivated?
I see that the inline js doesn’t exist in the page’s HTML what is the direct reason why the buttons don’t work. JS is enqueued inline instead of using a js file since version 2.3.
Best Regards
-
This reply was modified 5 years, 3 months ago by taisho.
Plugin Author
taisho
(@taisho)
To further help with troubleshooting, you could put this line as the 1st line of the function qib_enqueue_script()
in plugin’s PHP file:
echo 'test';
This would give an answer to whether the function executes at all. If the ‘test’ doesn’t show up on the top of the screen, you may try to change this line:
add_action( 'template_redirect', 'qib_enqueue_script' );
to:
add_action( 'template_redirect', 'qib_enqueue_script', 20 );
and this:
add_action( 'template_redirect', 'qib_add_to_cart_quantity_handler' );
to:
add_action( 'template_redirect', 'qib_add_to_cart_quantity_handler', 30 );
-
This reply was modified 5 years, 3 months ago by taisho.
Added the echo ‘test’; and also changed the lines add_action( ‘template_redirect’, ‘qib_enqueue_script’ ); and add_action( ‘template_redirect’, ‘qib_add_to_cart_quantity_handler’ );
It doesnt help. Maybe you can write me an email so I will provide you access to admin?
Plugin Author
taisho
(@taisho)
The “test” shows up, so the function executes and the other code lines that I gave are definitely not needed then.
The problem is with built-in WooCommerce function wc_enqueue_js
. Somehow the script doesn’t get added to page’s HTML. It’s definitely not a simple bug because it works correctly on a few test environments. I had no other reports of such a problem and version 2.3. was released a couple of weeks ago.
Please deactivate the plugin and check whether error 500 still appears on page load. If it does, it may be the reason why the wc_enqueue_js
function breaks. If there is no error 500 after deactivation it means that the plugin causes it, which would be very strange and hard to troubleshoot.
-
This reply was modified 5 years, 3 months ago by taisho.
-
This reply was modified 5 years, 3 months ago by taisho.
I deactivated the plugin. Could you please check again?
Plugin Author
taisho
(@taisho)
The error 500 (in chrome F12, Network tab, then reload the page) still persists with the plugin deactivated. It means that the HTML document is not correctly loaded for some reason. The 500 errors are rather hard to troubleshoot.
Probably this error also happened with the old plugin version but using a separate file for the scripts made the plugin work correctly anyway. There is a big chance that when this error is gone, the plugin will work as it should.
Got error log:
[Wed Aug 14 13:30:56 2019] [error] [client *****] The WC_Cart::get_cart_url function is deprecated since version 2.5. Replace with wc_get_cart_url.
Any idea?
Plugin Author
taisho
(@taisho)
It means that something, possibly your theme uses WC()->cart->get_cart_url()
that no longer works since WooCommerce version 2.5 and wc_get_cart_url
should be used instead.
Plugin Author
taisho
(@taisho)
I see that now the website works correctly with the current version of Qty Increment Buttons, so I’m closing this topic.
-
This reply was modified 5 years, 2 months ago by taisho.