'Add To Cart' button becomes 'View Cart' after click


So, andre_lefebvre and I are talking over on this thread: https://wpmudev.com/forums/topic/marketpress-audio-store-pluginthemetemplate-beta .

He asked (and I think it’s a great idea) if we could change the ‘Add to Cart’ button to a ‘View Cart’ button after the user adds a product to his cart.

I have the concept working by a quick modification of the core ajax-cart.js file, but I’d like to be able to run it from a plugin rather than modding core.

Here’s the JS: http://pubcdn.pottervilla.com/view-cart-button/ajax-cart.js

And here’s the non-working plugin: http://pubcdn.pottervilla.com/view-cart-button/add_view_cart_to_mp.php .

A) The js file works if anyone is looking for this feature.

B) Can someone who is better at JS help me get the plugin part fixed? I’m a PHP and CSS guy.


– Jonathan