dtuzjzs3853 2017-01-10 22:59
浏览 89
已采纳

WooCommerce:在购物车页面上移动优惠券字段

I am trying to change the position of the coupon field on the cart page. I am vaguely familiar with actions and hooks, so I know I need to remove the woocommerce_cart_coupon action first and hook it to a different action, as in this example:

remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
add_action( 'woocommerce_checkout_before_customer_details', 'woocommerce_order_review', 10 );

My problem is, I don't know to from where to unhook this action. I cannot find a list of cart hooks and their hooked actions (like the content-single-product.php file) + order.

The coupon field should be placed after the "Proceed to Checkout" button. Any ideas?

Thanks

  • 写回答

2条回答 默认 最新

  • doushenjia8514 2017-01-10 23:31
    关注

    The hook woocommerce_cart_coupon doesn't hook the coupon php code itself and you will not be able to use it as in your example.

    The related coupon php code (on cart page) is located on cart/cart.php template at line 132 to 150 and isn't hooked within a separate template. So You will have to edit cart/cart.php template, and this is not going to be so easy.

    Here is the official related documentation for Overriding Templates via a Theme (Templates structure)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了