Woocommerce, How to edit the “added to cart” message

前端 未结 6 868
感情败类
感情败类 2021-02-08 11:02

When click on add to cart button, the Woocommerce shows the message, view cart, I want to edit this message, actually edit all the span, put some icon etc...

6条回答
  •  孤城傲影
    2021-02-08 11:43

    If you look at add-to-cart.js it fires a trigger added_to_cart on adding a product to cart. I hooked into that and did this

    jQuery(document.body).on("added_to_cart", function( data ) {
        jQuery('button.added').nextAll().remove();
        jQuery('button.added').after(' Cart Updated');
    });
    

    Here you can add anything after product is added to cart.

    Hope that helps!

提交回复
热议问题