-2

I am new to WooCommerce and want to customize the functionality of add to cart. Can you please tell me where the function located along with the filename?

2

To do this you need to use the woocommerce 'woocommerce_add_to_cart' hook to add your custom function. something like this :

add_action('woocommerce_add_to_cart', 'my_function');
function my_function(){
    //........
}

This has been answered in another question here : https://stackoverflow.com/a/34255005/3134410

  • thank you... can you tell me where woocommerse defined this? – user3591025 Dec 21 '17 at 14:42
  • You're welcome. This is defined here '/includes/class-wc-cart.php' but it's not recommended to modify woocommerce core as you can lose your changes in every update. Tha's why the best way to do it is to use a hook to add your custom function to 'woocommerce_add_to_cart' – Badr Dec 21 '17 at 14:47
  • I want to add to cart multiple products just like, /checkout/?add-to-cart=244&225 is this possible? – user3591025 Dec 21 '17 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.