Skip to content

Instantly share code, notes, and snippets.

@webaware
Last active March 17, 2022 17:45
Show Gist options
  • Save webaware/c6a6286026eb6a89e5a3 to your computer and use it in GitHub Desktop.
Save webaware/c6a6286026eb6a89e5a3 to your computer and use it in GitHub Desktop.
display WooCommerce notices in any page by shortcode [woocommerce_notices]
<?php
/*
Plugin Name: WooCommerce Notices Shortcode
Plugin URI: https://gist.github.com/webaware/c6a6286026eb6a89e5a3
Description: display WooCommerce notices in any page by shortcode [woocommerce_notices]
Author: WebAware
Author URI: https://shop.webaware.com.au/
*/
if (!defined('ABSPATH')) {
exit;
}
add_shortcode('woocommerce_notices', function($attrs) {
if (function_exists('wc_notice_count') && wc_notice_count() > 0) {
?>
<div class="woocommerce-notices-shortcode woocommerce">
<?php wc_print_notices(); ?>
</div>
<?php
}
});
@neilbannet
Copy link

You are angel :*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment