English 中文(简体)
wc_print_notices is not show any information in woobusiness pages?
原标题:wc_print_notices is not displaying any messages in woocommerce pages?

I have used default woocommerce templates for shop, cart and single page. I have not removed any hooks either but also I am not getting any message. Any Idea?

add_action(  woocommerce_before_single_product ,    Cusotm_wc_print_notices , 10 );
function Cusotm_wc_print_notices()
{
   echo  Hook is working fine ;
}

我正在获得这一信息。 Hook正在做的是罚款,但不是印本。

问题回答

我并不真正确定问题是什么。 你们的问题需要进一步的细节。 既然如此,你可以尝试在你的职能中增加这一法典。 页: 1

add_action(  template_redirect ,  test  );
function test() {

    wc_add_notice( __(  Sorry there was a problem. ,  woocommerce  ),  error  );

}

让我知道它是否做了些什么。


<>>>>>

如果是这样的话:

add_action(  woocommerce_before_single_product ,    Cusotm_wc_print_notices , 10 );
function Cusotm_wc_print_notices()
{
   $notices = WC()->session->get( wc_notices );
   print_r($notices);
}

它不会奏效,因为一旦打电话到wc_print_notices(,就不会有<>$notices。

努力改变优先事项,你们将有所作为。 我们应当这样做:

add_action(  woocommerce_before_single_product ,    Cusotm_wc_print_notices , 9 ); 

reigelgallarde.me
use priority below 10. Because WooCommerce is using 10.

add_action(  woocommerce_before_single_product ,  wc_print_notices , 10 );




相关问题
Wrap stray text in <p> tags

Wordpress issue.. how do I wrap stray text in P tags? Example: Before- <div class = "content"> <img src = "hello.jpg"/> <h1>Introduction</h1> Hello! this is ...

Using jQuery Plugins with Wordpress

Having a bit of trouble using jQuery plugins (Superfish, jQuery UI, etc) using Wordpress. Everything works fine in my plain non-Wordpress site, but Wordpress seems to conflict with JQuery. There must ...

WordPress Data Storage Efficiency

I ve been asked to review a WordPress plugin of sorts and try to find ways of making it faster. The premise of this plugin is basically to store a bunch of users and shifts and appointments and ...

Why can t I properly style a blockquote in Wordpress?

On the design I just created for my website, I have a blockquote styled with two quote images using the span technique in css: blockquote { background-image: url(images/openquote.jpg); background-...

How does the WordPress <!--nextpage--> tag actually work?

What happens? I m guessing that somehow the post or page is parsed before displaying, and then just split into two methods? I can t seem to find any documentation on how the underlying <?php ...

Wordpress Plug-ins: How-to add custom URL Handles

I m trying to write a Wordpress Plug-in but can t seem to figure out how you would modify how a URL gets handled, so for example: any requests made for: <url>/?myplugin=<pageID> will ...

热门标签