admin管理员组文章数量:1429486
I am trying to add this to functions.php. In my test lab on a different site it adds the test info information fine. But on the website I am trying to add it to nothing happens. The website is running a builder thrifty theme with the latest woocommerce. Any ideas? I'm basically just wanting to add a line of text on every product page that is like a disclaimer but can't.
add_action('woocommerce_before_add_to_cart_form','print_something_below_short_description');
function print_something_below_short_description() {
echo 'Test Info.';
}
I am trying to add this to functions.php. In my test lab on a different site it adds the test info information fine. But on the website I am trying to add it to nothing happens. The website is running a builder thrifty theme with the latest woocommerce. Any ideas? I'm basically just wanting to add a line of text on every product page that is like a disclaimer but can't.
add_action('woocommerce_before_add_to_cart_form','print_something_below_short_description');
function print_something_below_short_description() {
echo 'Test Info.';
}
Share
Improve this question
edited Jun 6, 2017 at 2:56
DaveLak
1,0577 silver badges18 bronze badges
asked Jun 6, 2017 at 1:06
WebberMDWebberMD
91 silver badge2 bronze badges
2 Answers
Reset to default 1It's possible the theme or another plugin are using that hook with a later priority. Your add_action
would have the default of 10; try giving it a 12 or a 20, etc. and see if the text shows up.
add_action('woocommerce_before_add_to_cart_form','print_something_below_short_description', 10);
You can read about Priority with Action Hooks here.
Please try this code. Hope it will work now.
function action_woocommerce_before_add_to_cart_form( ) {
echo 'Test Info.';
};
add_action( 'woocommerce_before_add_to_cart_form', 'action_woocommerce_before_add_to_cart_form', 10, 0 );
本文标签: actionsFunctionsphp change for Woocommerce not working
版权声明:本文标题:actions - Functions.php change for Woocommerce not working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745541926a2662532.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论