custom notice in product page
-
jQuery(document).ready(function($) { var notice = $(".woocommerce-message, .woocommerce-error, .woocommerce-info"); if (notice.length > 0) { var message = notice.html(); var type = notice.hasClass("woocommerce-error") ? "error" : notice.hasClass("woocommerce-message") ? "success" : ""; $("#woocommerce-popup").addClass(type); $("#woocommerce-popup .popup-content").html(message); $("#woocommerce-popup").fadeIn(); setTimeout(function() { $("#woocommerce-popup").fadeOut(); }, 5000); } $(".close-popup").click(function() { $("#woocommerce-popup").fadeOut(); });});
With this code, everything is fine, as long as I have the code in the file woocommerce.php
<?php wc_print_notices(); ?>
which in this case, both in ajax and in the default notification, the phrase “product added to cart” is displayed, and as soon as I delete exactly everything returns to the default WooCommerce state, that is, a message appears at the top of the product tabs and there is no longer any news of showing the custom message.How do I tell WooCommerce to use a custom message instead of my default message?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.