mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
https://stackoverflow.com/questions/65509413/hide-or-edit-the-you-cannot-add-another-xxx-to-your-cart-error-message-in-wo/65528190
17 lines
596 B
Text
17 lines
596 B
Text
function filter_woocommerce_cart_product_cannot_add_another_message( $message, $product_data ) {
|
|
$message = '<div class="hide-this-error-message"></div>';
|
|
|
|
return $message;
|
|
}
|
|
add_filter( 'woocommerce_cart_product_cannot_add_another_message', 'filter_woocommerce_cart_product_cannot_add_another_message', 10, 2 );
|
|
|
|
function action_wp_footer() {
|
|
?>
|
|
<script>
|
|
jQuery(document).ready(function($) {
|
|
$( '.hide-this-error-message' ).closest( 'ul.woocommerce-error' ).hide();
|
|
});
|
|
</script>
|
|
<?php
|
|
}
|
|
add_action( 'wp_footer', 'action_wp_footer' );
|