我正在尝试更改购物车页面上优惠券字段的位置。我对动作和钩子有点熟悉,所以我知道我需要先删除 woocommerce_cart_coupon 动作并将其连接到不同的动作,如下例所示:
remove_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
add_action( 'woocommerce_checkout_before_customer_details', 'woocommerce_order_review', 10 );
Run Code Online (Sandbox Code Playgroud)
我的问题是,我不知道从哪里解开这个动作。我找不到购物车挂钩列表及其挂钩操作(如content-single-product.php文件)+ 订单。
优惠券字段应该放在“Proceed to Checkout”按钮之后。有任何想法吗?
谢谢
我一直在尝试弄清楚如何使我的支持访客结帐的网站正常运行,但到目前为止尚未成功。我激活了以下 WooCommerce 设置:
通常,用户应该能够在不创建帐户的情况下结账,但如果愿意,也可以选择创建帐户。但是,如果我以访客身份下测试订单并选中“创建帐户?” 框+填写用户名和密码字段,为计费和运输提供的任何信息都不会显示在“谢谢”页面或 WP 仪表板上。就像“创建帐户?”一样。框+用户名和密码将被忽略。
我怀疑这与我更改了帐户注册字段的默认位置有关。我已将它们添加到 form-login.php 文件中,以便它显示在与登录表单相同的部分中。它们最初包含在 form-billing.php 字段中。请在下面找到这些文件:
表单计费.php
<?php
/**
* Checkout billing information form
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-billing.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. …Run Code Online (Sandbox Code Playgroud)