栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

在Woocommerce中使用AJAX刷新/更新小型购物车

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

在Woocommerce中使用AJAX刷新/更新小型购物车

woocommerce_add_to_cart_fragments
您的功能中缺少过滤器挂钩…

要使其正常工作,应为:

add_filter( 'woocommerce_add_to_cart_fragments', 'header_add_to_cart_fragment', 30, 1 );function header_add_to_cart_fragment( $fragments ) {    global $woocommerce;    ob_start();    ?>    <a  href="<?php echo esc_url(wc_get_cart_url()); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - <?php echo $woocommerce->cart->get_cart_total(); ?></a>    <?php    $fragments['a.cart-customlocation'] = ob_get_clean();    return $fragments;}

代码进入您的活动子主题(或活动主题)的function.php文件中。未经测试。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/413428.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号