php - 如果检查了贝宝选项,请删除表单验证 Woocommerce
问题描述
我只是想知道当用户选择贝宝作为付款选项时,如果我想从结帐表单中删除验证,if 语句会是什么?
我知道我可以使用类似的东西
function not_required_fields( $f ) {
unset( $f['billing']['billing_first_name']['required'] ); // that's it
unset( $f['billing']['billing_phone']['required'] );
return $f;
}
但我需要先知道 if 语句,例如
if(payment_method == PayPal)
{
above code here
}
唯一的问题是我不知道如何在 woocommerce 中编写它
解决方案
推荐阅读
- jenkins - 如何减少詹金斯管道脚本的长度?
- c++ - 就地重新初始化对象
- android - 改造:预期 BEGIN_ARRAY 但在第 1 行第 2 列路径处是 BEGIN_OBJECT
- mapbox - 将 Geoserver 图层组添加到使用 mapbox-gl-js 创建的地图中
- java - Java 流,等待谷歌距离矩阵返回结果
- firebase - Firestore中更新和排序朋友列表期间的无成本方法
- angular6 - ngx-spinner 在订阅之外不工作
- angular - 手动调用 Angular PreloadingStrategy 的 preload 方法
- c# - 如何修复'System.NullReferenceException:'对象引用未设置为对象的实例。
- c# - 我如何知道 .NET Standard 需要哪些平台扩展?