在某些类别或标签中禁用折扣-Woocommerce存款插件

时间:2018-12-04 17:52:11

标签: wordpress woocommerce payment

我正在使用Woocommerce和Im运行我的网站,我使用存款插件为用户提供了更改,以便他们使用借记卡付款时可享受7%的折扣。 现在,某些产品具有保留产品的定金选项(30%)以及常规的全额付款选项。

这就是问题...如果他们选择存款选项,他们将获得7%的折扣,而我只需要支付全部金额就可以享受该折扣。

有什么想法要实现吗?

        // Gets the settings.
    $gateways = get_option('woo_payment_discounts_setting');
    $gateways = maybe_unserialize($gateways);
    if (isset($gateways[WC()->session->chosen_payment_method])) {
        $value = $gateways[WC()->session->chosen_payment_method]['amount'];
        $type = $gateways[WC()->session->chosen_payment_method]['type'];
        if (apply_filters('woo_payment_discounts_apply_discount', 0 < $value, $cart)) {
            $payment_gateways = WC()->payment_gateways->payment_gateways();
            $gateway = $payment_gateways[WC()->session->chosen_payment_method];
            $discount_name = $this->discount_name($value, $gateway);
            $cart_discount = $this->calculate_discount($type, $value, $cart->cart_contents_total) * -1;
            $cart->add_fee($discount_name, $cart_discount, true);
        }
    }
}

0 个答案:

没有答案