woocommerce - 使用贝宝时如何设置代码片段以禁用yith积分奖励
问题描述
我正在寻找一种在使用贝宝作为付款方式时禁用 yith 积分奖励的方法。
我有此代码可以禁用特定产品的 yith 积分奖励,但无法找到禁用付款方式的方法
其他代码是默认代码,用于排除特价产品并在兑换时禁用赚取积分。
我认为混合使用贝宝时可能会禁用赚取积分。
我真的很感激一些帮助!
'exclude_product_on_sale' => array(
'name' => esc_html__( 'Exclude on sale products', 'yith-woocommerce-points-and-rewards' ),
'desc' => esc_html__( 'If enabled, sale products will not assign points to your users', 'yith-woocommerce-points-and-rewards' ),
'yith-type' => 'onoff',
'type' => 'yith-field',
'id' => 'ywpar_exclude_product_on_sale',
'default' => 'no',
),
if( class_exists('YITH_WC_Points_Rewards_Frontend')){
add_filter('ywpar_get_product_point_earned', 'ywpar_get_product_point_earned_gift_card', 10, 2 );
function ywpar_get_product_point_earned_gift_card( $points, $product ){
if( $product->is_type('gift-card')){
$points = 0;
}
return $points;
}
add_filter('ywpar_calculate_rewards_discount_item_price', 'ywpar_calculate_rewards_discount_item_price', 10, 3);
function ywpar_calculate_rewards_discount_item_price( $price, $value, $product_id){
$product = wc_get_product( $product_id );
if( $product->is_type('gift-card')){
$price = 0;
}
return $price;
}
}
'disable_point_earning_while_reedeming' => array(
'name' => esc_html__( 'Do not assign points to orders in which the user is redeeming points', 'yith-woocommerce-points-and-rewards' ),
'desc' => esc_html__( 'Enable to not assign points to orders in which the user redeems points', 'yith-woocommerce-points-and-rewards' ),
'id' => 'ywpar_disable_earning_while_reedeming',
'type' => 'yith-field',
'yith-type' => 'onoff',
'default' => 'no',
'deps' => array(
'id' => 'ywpar_enable_points_upon_sales',
'value' => 'yes',
'type' => 'hide',
),
),
解决方案
推荐阅读
- android - Google Map 使用“Always”设置为默认启动器,如何在再次单击地图时获取该设置
- angular - 更改 ngForOf 以从 Behavior Subject 获取 Iterable
- java - org.apache.cxf.jaxrs.client.WebClient 中的 RecieveTimeout 和 SynchronousTimeout 有什么区别?
- node.js - 在 Node.js 中按顺序排列的“n”个 API 调用?
- asp.net - CurrentCulture 和 CurrentUICulture 是否已缓存?
- angular - 无法在离子 3 中获取未定义或空引用的属性“DestinationType”
- node.js - 如何在本地主机上访问磁盘上的图像并通过网站上的 url 访问
- c# - 如何验证具有在 Linq 表达式中传递的特定值的 Moq 方法调用
- javascript - 将 jsp 导航到 servlet 时出现 404
- php - 使用 ajax 请求发送 csrf_token