Project-404
Project-404

Reputation: 305

Woo-commerce add to cart button missing. (yep, another one)

I have the problem that with merchandise where there multiple options (t-shirt sizes, etc) that the 'add to cart' button is missing. It is OK where there there is only one option - a cd for example. I have entered all the info, stock numbers, prices, etc.

The problem persists if I turn off all other plugins. I can't see an error in the Java console (I tried a plugin that is supposed to fix java errors anyway) and the add to cart button is visible if I switch to another theme. Be great of someone who has been down this path can get me started on finding a solution.

Thanks for you help!

http://5.133.182.68/~knifewor/product/knifeworld-gold-logo-t-shirt/

Update

Turning debugging on I can see the following error:

Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/knifewor/public_html/wp-includes/functions.php on line 3245

Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/knifewor/public_html/wp-includes/functions.php on line 3245

Notice: Cookie cannot be set - headers already sent in /home/knifewor/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 375

Notice: Cookie cannot be set - headers already sent in /home/knifewor/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 375

Notice: Cookie cannot be set - headers already sent in /home/knifewor/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 375

And I now notice on the shop page the footer fails to load.

Upvotes: 0

Views: 1112

Answers (2)

helgatheviking
helgatheviking

Reputation: 26319

Normally, if the problem goes away when you switch themes, especially if there's no JS error, then we can assume the problem is in your theme's WooCommerce templates. They are probably out of date. I fixed a lot of themes that "broke" when WooCommerce updated to 2.0/2.1.

In the admin, under WooCommerce go to System Settings and at the bottom of the page you should see any templates that are being overridden in the theme. I think it should also say which templates are out of date.

If you view source you will see the page is incompletely loaded. This means wp_footer() is never run and therefore all the scripts that belong in the footer are never loaded... including WooCommerce's add to cart scripts.

Therefore, I second @sabanix's answer to turn on WP_DEBUG. The problem may or may not be in your theme's WooCommerce templates, or a more generic error in your theme.

If I had to guess, it is probably single-product/add-to-cart/variable.php template. I would suggest renaming it (or deleting it) so that WooCommerce will use its default template and see if that resolves it.

Upvotes: 1

sabarnix
sabarnix

Reputation: 775

There is a php error in the page. You need to turn on the WP_DEBUG to see the error.

Upvotes: 1

Related Questions