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 脱敏项目合作,ner需求合作
  • ¥15 脱敏项目合作,ner需求合作
  • ¥30 Matlab打开默认名称带有/的光谱数据
  • ¥50 easyExcel模板 动态单元格合并列
  • ¥15 res.rows如何取值使用
  • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
  • ¥15 CSP算法实现EEG特征提取,哪一步错了?
  • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
  • ¥15 vue3前端取消收藏的不会引用collectId
  • ¥15 delphi7 HMAC_SHA256方式加密