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...
相关问题
- Display product ACF field value in Woocommerce tra
- Adding a custom button after add to cart button in
- How to add a “active” class to a carousel first el
- Setting custom order statuses as valid for payment
- change the font size in tag cloud
相关文章
- wordpress新增页面如何个性化设置
- select query in wordpress
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- Native hooking in Android Client
- Change order status just after payment in WooComme
- Publishing or uploading failed. Error message: “Th
- Facebook Login With WP JWT Auth
Replaced by
wc_add_to_cart_message_html
filter hook, the 2nd function argument has changed to$products
(instead of$product_id
)…You can make changes on the code inside this hooked function, like in this thread:
Related threads (for Woocommerce 3+):
If you look at
add-to-cart.js
it fires a triggeradded_to_cart
on adding a product to cart. I hooked into that and did thisHere you can add anything after product is added to cart.
Hope that helps!
Add a filter to your theme/functions.php. The code below just overrides the existing $message. This overwrites $message with an nearly identical one that prepends a "checkout" link to the message.
Make sure you return the $message.
You can of course just modify the existing message, as the entire thing is passed as a string via the first param or $message var.
In Woocommerce 3.0 "wc_add_to_cart_message" is obsolete and no longer works. So while the answer by @zmonteca was ok, is no longer working on the Woocommerce 3.0
Just replace "wc_add_to_cart_message" with "wc_add_to_cart_message_html" and voile... works.
@Dante is correct, the solutions provided by @BradleyD won't work for ajax_add_to_cart on shop page.
The solution provided by @Abstract is working as expected. I am also using his solution.
Another jQuery approach is to to listen for the the ajaxSuccess event on the document object and do the desired modifications for the clicked button.
Something like that should work:
Have you tried a filter like the following
In reply to the ajax message update, try a translation function like: