Add to cart and quantity in Woocommerce

Asked

Viewed 801 times

1

I have a website using Woocommerce, and I need not only the product detail page to show the option to add to the cart, and the quantity, but, to appear in product listings, categories and etc.

There is some plugin for this, even if being paid?

Someone’s already done it?

1 answer

0

Add this code to the functions.php of your theme

add_action( 'init', 'erc_shop_archive_add_to_cart_button' );
function erc_shop_archive_add_to_cart_button() {
    add_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart', 11);
}

What this function does is to add an action called woocommerce_template_loop_add_to_cart in the woocommerce_after_shop_loop_item event when the init hook is started.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.