checkout

How to disable fields that are pre-filled in WooCommerce checkout?

空扰寡人 提交于 2021-02-19 08:59:10
问题 I would like to prevent (make these fields readonly, for example) users from changing their billing information on the WooCommerce checkout form. I'm currently using this code snippet: add_filter('woocommerce_billing_fields', 'mycustom_woocommerce_billing_fields', 10, 1 ); function mycustom_woocommerce_billing_fields($fields) { $fields['billing_first_name']['custom_attributes'] = array('readonly'=>'readonly'); $fields['billing_last_name']['custom_attributes'] = array('readonly'=>'readonly');

Enabling Payment method based on the customers location

社会主义新天地 提交于 2021-02-19 05:25:23
问题 I don't know if it's possible, but, we would need to add some different payment methods for Barcelona. So, our idea is that if the customer lives in Barcelona area (Catalunya), he will see a credit card payment method and a bank transfer account different than the rest of Spain. Is that possible with WooCommerce? Thanks. 回答1: If you want to enable this kind of feature in WooCommerce , Customers need to be registered and logged on first, as it's the only way to get they town location before

Format billing phone number on WooCommerce checkout

南楼画角 提交于 2021-02-18 18:12:01
问题 For the WooCommerce checkout billing field, how can I make this field require 9 numbers and insert dashes for proper phone formatting? For example, instead of typing out 3053453212 in the phone number field, it displays: (305-345-3212) 回答1: Based on "Formatting a phone number in a form using jquery" answer code, here is the way to format the Woocommerce billing phone: add_action('wp_footer', 'format_checkout_billing_phone'); function format_checkout_billing_phone() { if ( is_checkout() && !

Format billing phone number on WooCommerce checkout

若如初见. 提交于 2021-02-18 18:11:12
问题 For the WooCommerce checkout billing field, how can I make this field require 9 numbers and insert dashes for proper phone formatting? For example, instead of typing out 3053453212 in the phone number field, it displays: (305-345-3212) 回答1: Based on "Formatting a phone number in a form using jquery" answer code, here is the way to format the Woocommerce billing phone: add_action('wp_footer', 'format_checkout_billing_phone'); function format_checkout_billing_phone() { if ( is_checkout() && !

Format billing phone number on WooCommerce checkout

笑着哭i 提交于 2021-02-18 18:09:21
问题 For the WooCommerce checkout billing field, how can I make this field require 9 numbers and insert dashes for proper phone formatting? For example, instead of typing out 3053453212 in the phone number field, it displays: (305-345-3212) 回答1: Based on "Formatting a phone number in a form using jquery" answer code, here is the way to format the Woocommerce billing phone: add_action('wp_footer', 'format_checkout_billing_phone'); function format_checkout_billing_phone() { if ( is_checkout() && !

Format billing phone number on WooCommerce checkout

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 18:08:59
问题 For the WooCommerce checkout billing field, how can I make this field require 9 numbers and insert dashes for proper phone formatting? For example, instead of typing out 3053453212 in the phone number field, it displays: (305-345-3212) 回答1: Based on "Formatting a phone number in a form using jquery" answer code, here is the way to format the Woocommerce billing phone: add_action('wp_footer', 'format_checkout_billing_phone'); function format_checkout_billing_phone() { if ( is_checkout() && !

Dynamic checkout custom fields per persons and items in Woocommerce bookings

折月煮酒 提交于 2021-02-18 17:55:44
问题 For a bookings website I'm trying to create a function which makes it possible to add an attendee list, based on the amount of persons. I've already got the code for a single booking, thanks to LoicTheAztec. That part is working fine. I also need the same functionality for multiple bookings. How can I achieve this? Here is the code: //* Add a new checkout field add_filter( 'woocommerce_checkout_fields', 'ppp_filter_checkout_fields' ); function ppp_filter_checkout_fields($fields){ $fields[

Add a product add-on field to specific products on WooCommerce

一个人想着一个人 提交于 2021-02-17 03:22:57
问题 I need to change the code to not display text area on all of my WooCommerce products but only 2, this is on my WordPress child theme under functions.php file. I have changed $product_id to $product_id = 2130 (my specific product id) , not sure if I'm supposed to change all the $product_id or $_POST for this code to display on only 2 products It is for a specific product or products that gets personalized with a name. I have tried changing the code $product_id to numerous other extensions to

Conditionally hide Woocommerce checkout custom field based on free shipping

只谈情不闲聊 提交于 2021-02-16 20:19:30
问题 In WooCommerce, I am trying to hide one custom added field whenever "free delivery" is selected (automatic selection, based on order amount). I was thinking that I found a solution with code below, but when I load a page on new (incognito) browser window, the field is present and if refresh it, the field is hidden again. // Hide address field, when Free Shipping mode is selected add_filter('woocommerce_checkout_fields', 'xa_remove_billing_checkout_fields'); function xa_remove_billing_checkout

Add custom tax value at woocommerce checkout

情到浓时终转凉″ 提交于 2021-02-16 14:35:12
问题 I want to add custom % value at woocommerce checkout page, but I want to show it only for Swiss country and hide it for others. Now I have the right code working for that, but the problems is that Im not able to show it when user choose switzerland. Here is a code so please help me see what Im doing wrong here //Add tax for CH country add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' ); function woocommerce_custom_surcharge() { global $woocommerce; if ( WC()-