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 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 ); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛