donglanche9257
donglanche9257
2017-03-24 12:43
浏览 28
已采纳

woocommerce挂钩警告“找不到功能”

I wanted to use hooks in my woocommerce single product page to do some changes.

So I added the following code into my function.php in my child-theme:

add_action( 'woocommerce_single_product_summary',' woocommerce_template_single_add_to_cart', 35 );

Now there should be a second add-to-cart button on my product page. But all I get is the following warning:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ' woocommerce_template_single_add_to_cart' not found or invalid function name in /home/userXXX/htdocs/vintagehome/wp-includes/class-wp-hook.php on line 298

You guys are my last chance to get this thing done! Please help me..

Greets Alex

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongxun2903
    dongxun2903 2017-03-24 12:48
    已采纳
    // define the woocommerce_single_product_summary callback 
    function action_woocommerce_single_product_summary( $woocommerce_template_single_title, $int ) { 
        // make action magic happen here... 
    }; 
    
    // add the action 
    add_action( 'woocommerce_single_product_summary', 'action_woocommerce_single_product_summary', 10, 2 ); 
    
    点赞 评论

相关推荐