has anyone been able to add multiple products of the same kind, with a click of add-to-cart button. I have enclosed a picture to show what I would like to build.
Objective: To be able to add multiples of a product to cart at once on my CATALOG page, NOT viewing product page.
This is what I want to build. Check ink.talentosoft.com, imagine, under the products, the “Details” link is to replace the number input, and “Add to Cart” to replace for the add cart button that can handle the number input
I have looked at the code for single product/add-to-cart/simple product, the problem is: the number input and add to cart button are enclosed in a form element. Due to wp code being spread out, I am unable to find the handler for this form. If the handler for the form is found, may I theoretically copy past the simple.php
add multiples section, right into my catalog page?
I have looked at and tried to use hooks do_action( "woocommerce_simple_add_to_cart" );
to bring up the single.php
file.
I want to ask about the woocommerce_add_to_cart_action()
method in plugin/woocommerce/woocommerce-function.php, Can I directly call this method ( add a hook to this method ), How do I keep track of the number input so I know how many products the user wants in the cart?
If I make this change, will this neglect woo’s AJAX functionality to add to cart? Of course depending on what stage of the add to cart transaction I am able to squeeze in to this event handler.
This solution helped me a lot.
Create this file inside your theme:
woocommerce/loop/add-to-cart.php
. And add the following code to it: