I have an error with adding products to the cart from the catalog page. If I add products to the cart from the product page, then there is no error. If I add simple product to the cart from the catalog page, there is also no error…
Error log:
Fatal error: Uncaught Error: Call to a member function get_permalink() on bool in /var/www/u1382137/data/www/dens-pizza.ru/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1134
Трассировка стека
1.
WC_Cart->add_to_cart(0, 1, 7617, Array)
/var/www/u1382137/data/www/dens-pizza.ru/wp-content/plugins/et-core-plugin/packages/st-woo-swatches/public/partials/class-st-woo-shop.php:348
2.
St_Woo_Shop->add_to_cart(”)
/var/www/u1382137/data/www/dens-pizza.ru/wp-includes/class-wp-hook.php:292
3.
WP_Hook->apply_filters(”, Array)
/var/www/u1382137/data/www/dens-pizza.ru/wp-includes/class-wp-hook.php:316
4.
WP_Hook->do_action(Array)
/var/www/u1382137/data/www/dens-pizza.ru/wp-includes/plugin.php:484
5.
do_action(‘wp_ajax_sten_wc…’)
/var/www/u1382137/data/www/dens-pizza.ru/wp-admin/admin-ajax.php:187
6.
{main}
thrown in /var/www/u1382137/data/www/dens-pizza.ru/wp-content/plugins/woocommerce/includes/class-wc-cart.php on line 1134
!!!!!!!!!!!!!! Please, don’t update my theme unnecessarily. Last time, this did not lead to a solution to the problem.
I need not hide the add to cart button, but make it work. !!!!!!!!!!!!!!
As I understand, the error occurs due to the fact that, according to the woocommerce’s logic, if the product is variable, then instead of the “add to cart” action, there should be a “select options” action.
Is it possible to add some code or install some plugin so that when a variable product is added to the cart from the catalog page, the default variation will be added to the cart?