/** * Returns payment methods info html * * @param array $atts * @return string */ public static function payment_methods_info($atts) { WC_GZD_Payment_Gateways::instance()->manipulate_gateways(); ob_start(); wc_get_template('global/payment-methods.php'); $return = '<div class="woocommerce woocommerce-gzd">' . ob_get_clean() . '</div>'; return $return; }
*/ public function init_fee() { $gateways = WC()->payment_gateways()->get_available_payment_gateways(); if (!($key = WC()->session->get('chosen_payment_method')) || !isset($gateways[$key])) { return; } $gateway = $gateways[$key]; if ($gateway->get_option('fee')) { $this->set_fee($gateway); } } /** * Sets fee for a specific gateway * * @param object $gateway */ public function set_fee($gateway) { $is_taxable = $gateway->get_option('fee_is_taxable', 'no') == 'no' ? false : true; $fee = $gateway->get_option('fee'); if ($is_taxable) { $tax_rates = WC_Tax::get_rates(); $fee_taxes = WC_Tax::calc_tax($fee, $tax_rates, true); $fee = $fee - array_sum($fee_taxes); } WC()->cart->add_fee(__('Payment charge', 'woocommerce-germanized'), $fee, $is_taxable); } } return WC_GZD_Payment_Gateways::instance();