wordpress - 如何从 woo commerce 结帐页面隐藏货到付款方式?
问题描述
当客户选择任何产品的任何插件时,如何从 woo commerce 结帐页面隐藏货到付款付款方式?
解决方案
/* 隐藏免费送货请试试下面的代码 */
function hide_free_shipping( $rates, $package ) {
if ( ) // as per your requirement add condition here
{
foreach( $rates as $rate_id => $rate_val ) {
if ( 'free_shipping' === $rate_val->get_method_id() ) {
unset( $rates[ $rate_id ] );
}
}
}
return $rates;
}
add_filter( 'woocommerce_package_rates', 'hide_free_shipping', 100, 2 );
推荐阅读
- swift - PKToolPicker 添加文本、形状和签名
- linux - 如何即时更改 KVM 的网络设置?
- java - 如何在 ImageJ/FiJiplugin uiService.show(BufferedImage) 中显示缓冲图像或浮点数组图像
- php - Wordpress WP_Query $args,显示已发布的帖子和当前用户的待处理帖子
- swift - 在“theMove *”类型的对象上找不到属性“move”
- android - 方向切换后播放声音文件 [Android Studio]
- php - 从 WooCommerce 中的订单中获取最后一个产品
- postgresql - 从 typeorm 中提取特定数据
- r - 使用基数 r 中的 hist 定制 y 轴以显示比例时出现意外的 y 轴值
- jmeter - 如何与多个线程共享 JSESSIONID?