payment-method

Adding a custom field to BACS account fields without overriding core files

℡╲_俬逩灬. 提交于 2021-02-19 01:32:33
问题 I have this situation - I made a changes in one of the woocommerce email templates, but I`m sure - these changes will be lost after next woocommerce update. As I know, I should use theme functions to bypass this problem. This is the code before changes: echo '<ul class="wc-bacs-bank-details order_details bacs_details">' . PHP_EOL; // BACS account fields shown on the thanks page and in emails $account_fields = apply_filters( 'woocommerce_bacs_account_fields', array( 'account_number'=> array(

Restrict payment gateways based on taxonomy terms in WooCommerce checkout

妖精的绣舞 提交于 2021-02-10 18:50:27
问题 In my WooCommerce store I want to restrict and show payment gateway(cheque) only if the product has particular product category with the category ID "266". Now I have this snippet but it does the opposite - it disabled the gateway on the checkout for particular product category: add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_unset_gateway_by_category' ); function bbloomer_unset_gateway_by_category( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( !

Restrict payment gateways based on taxonomy terms in WooCommerce checkout

家住魔仙堡 提交于 2021-02-10 18:49:09
问题 In my WooCommerce store I want to restrict and show payment gateway(cheque) only if the product has particular product category with the category ID "266". Now I have this snippet but it does the opposite - it disabled the gateway on the checkout for particular product category: add_filter( 'woocommerce_available_payment_gateways', 'bbloomer_unset_gateway_by_category' ); function bbloomer_unset_gateway_by_category( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( !

Assign a percentage fee to WooCommerce payment methods based on user roles

笑着哭i 提交于 2021-02-10 05:46:12
问题 How do I expand this snippet to include 2 more payment gateways with different fees? The payment gateways I want to add are 'cardgategiropay' and 'cardgateideal' and the fees are 3% and 2% respectively . add_action('woocommerce_cart_calculate_fees', 'sm_credit_card_fee_role_gateway', 10, 1); function sm_credit_card_fee_role_gateway($cart){ if (is_admin() && !defined('DOING_AJAX')) return; if ( ! ( is_checkout() && ! is_wc_endpoint_url('order-pay') ) ) return; if (!is_user_logged_in()) return;

Change specific payment gateway title in WooCommerce

大城市里の小女人 提交于 2021-02-05 08:36:07
问题 I need to change the Woocommerce payment gateway names, not the ones hat are displayed on the frontend(this can easily be achieved in the settings) but the inernatl titles Woo is using. In class-wc-gateway-cheque.php for example I found this $this->id = 'cheque'; but simply changing the name there did not work. How can I change the name Woocommerce is using internally for this payment method? 回答1: So what you can do instead is to copy the source code from WC_Gateway_Cheque Class to a plugin

Custom checkout field enable or disable payment methods in Woocommerce 3

孤者浪人 提交于 2021-02-04 20:39:11
问题 So i'm working on http://www.lichtunie.nl We have a functioning checkout page with the needed fields. The problem is this: In the Netherlands (where we're based) We have something called KvK, if you start a company you need to register it there and you get a KvK number. We can check those numbers through a website to see if they're legit and how their payment history is. Now we have the option of "paying with cheque" Which let's you order and pay within a 30 day time period after receiving

Custom checkout field enable or disable payment methods in Woocommerce 3

烂漫一生 提交于 2021-02-04 20:37:43
问题 So i'm working on http://www.lichtunie.nl We have a functioning checkout page with the needed fields. The problem is this: In the Netherlands (where we're based) We have something called KvK, if you start a company you need to register it there and you get a KvK number. We can check those numbers through a website to see if they're legit and how their payment history is. Now we have the option of "paying with cheque" Which let's you order and pay within a 30 day time period after receiving

Change Woocommerce cart items tax class based on chosen payment method

北慕城南 提交于 2021-01-29 14:15:07
问题 I have tried to implement code found on this site in a number of answers from a particular user with regard to refreshing the checkout based on a change to the payment gateway selected or to some other field change. However, when the JS is included in my function file, my checkout is stuck and I have ajax loading animated circles. I've already tried to adapt code from: Trigger ajax update_checkout event on shipping methods change in Woocommerce Update checkout ajax event when choosing a