drogon982007
2018-02-10 15:08
浏览 235
已采纳

在Woocommerce商店页面中显示添加到购物车ajax的数量框

I am new to Woocommerce. I was trying to show the quantity box in the shop page. I have used the below code and it's working as expected:

add_action( 'woocommerce_before_shop_loop', 'handsome_bearded_guy_select_variations' );

function handsome_bearded_guy_select_variations() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 30 );
}

But the problem is that ajax add to cart button got replaced with default one.

How can I enable back the ajax functionality on add to cart button with quantity field for Woocommerce archives pages?

图片转代码服务由CSDN问答提供 功能建议

我是Woocommerce的新手。 我试图在商店页面中显示数量框。 我使用了以下代码,它按预期工作:

  add_action('woocommerce_before_shop_loop','handsome_bearded_guy_select_variations'); 
 
功能handsome_bearded_guy_select_variations(){
remove_action('woocommerce_after_shop_loop_item  ','woocommerce_template_loop_add_to_cart',10); 
add_action('woocommerce_after_shop_loop_item','woocommerce_template_single_add_to_cart',30); 
} 
   
 
 

但问题是ajax添加 购物车按钮被默认替换。

如何在Woocommerce存档页面上添加到购物车按钮及数量字段时启用ajax功能?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题