I am currently using WooCommerce in a development environment and wanting to use the ‘Add to cart’ shortcode like [add_to_cart id=”99″]. This works fine, but I would like to add in functionality so that once a product has been added to the cart, the button becomes disabled and changes text to ‘Already in cart’ instead of ‘Add to cart’. The button needs to disable via AJAX so it can update immediately, but also still be disabled if the user goes to a different page then comes back.
I’ve been banging my head against the wall because I am not super familiar with PHP/JS so I have been struggling to get this to work.
I’d really appreciate some guidance as to how to create this functionality. I am more than comfortable editing files, I am just not sure of the syntax of the coding.
Read more here:: Disable ‘Add to cart’ shortcode if product is in cart (WooCommerce)