I am trying to change the classes for the "View cart" button after adding an item to the cart. What I tried to do is to hook into the "woocommerce_ajax_added_to_cart" action and insert my Javascript as below but this Breaks the AJAX call. I honestly don't know if I am using the correct hook:
function set_button_classes() {
echo "<script>document.getElementByClassName('added_to_cart wc-forward').classList.add('ct-cart-item', 'ct-offcanvas-trigger');</script>";
}
add_action( 'woocommerce_ajax_added_to_cart', 'set_button_classes', 10, 1 );
Any pointers would be really appreciated.