如何从 WooCommerce 中的calculate_shipping 访问公司名称?
我们需要从 WooCommerce 的结帐表单中的 calculate_shipping
中访问公司名称(来自 Shipping Method API) 在计算运输选项时,但似乎只有数组 $package
可用,其中转只需访问a $package['destination']
地址字段的精简版本。没有 $package['destination']['company']
。
作为帐单地址的一部分;
<input type="text" class="input-text " name="billing_company" id="billing_company" placeholder="" value="" autocomplete="organization">
作为送货地址的一部分;
<input type="text" class="input-text " name="shipping_company" id="shipping_company" placeholder="" value="" autocomplete="organization">
有没有办法直接访问“shipping_company”或“billing_company”文本字段中输入的内容或通过任何其他方式了解客户是公司还是个人?
我尝试过 WC()->checkout->get_value( 'shipping_company' )
但没有返回文本,并且没有 $_POST['shipping_company']< /code> 或
$_POST['billing_company']
尽管在更改地址详细信息时存在 AJAX 挂钩。
We need to access the company name from the checkout form in WooCommerce, inside the calculate_shipping
(from Shipping Method API) when calculating the shipping options, but it only seems to have the array $package
available which in turn just have access to a stripped down version of the $package['destination']
address fields. There is no $package['destination']['company']
.
The company name form field in checkout
As part of the Billing address;
<input type="text" class="input-text " name="billing_company" id="billing_company" placeholder="" value="" autocomplete="organization">
As part of the Shipping address;
<input type="text" class="input-text " name="shipping_company" id="shipping_company" placeholder="" value="" autocomplete="organization">
Is there a way to directly access what is entered into the "shipping_company" or "billing_company" textfields or by any other means know if the customer is a company or private person?
I've tried WC()->checkout->get_value( 'shipping_company' )
but that doesn't return the text and there is no $_POST['shipping_company']
or $_POST['billing_company']
despite the AJAX hook when changing address details.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论