woocommerce

woocommerce checkout conditional fields based on radio buttons choices

余生颓废 提交于 2021-02-04 21:07:38
问题 In my wordpress website I need to add some conditional fields in the woocommerce checkout page. I have already created the 2 fields and I now I need one field to show up based on the choices made on the other one. Field one's name (the parent field): billing_checkbox_cf Field two's name: billing_cf_in Based on "WooCommerce conditional custom checkout fields" answer thread, here's my code: add_action( 'woocommerce_after_checkout_form', 'cbi_cf_conditionally_hide_show', 6); function cbi_cf

woocommerce checkout conditional fields based on radio buttons choices

早过忘川 提交于 2021-02-04 21:05:37
问题 In my wordpress website I need to add some conditional fields in the woocommerce checkout page. I have already created the 2 fields and I now I need one field to show up based on the choices made on the other one. Field one's name (the parent field): billing_checkbox_cf Field two's name: billing_cf_in Based on "WooCommerce conditional custom checkout fields" answer thread, here's my code: add_action( 'woocommerce_after_checkout_form', 'cbi_cf_conditionally_hide_show', 6); function cbi_cf

Time based Enable/Disable Add to Cart in Woocommerce

依然范特西╮ 提交于 2021-02-04 20:50:50
问题 I would like my online shop to be deactivated or activated for a certain period of time. When the shop is deactivated, you can see the products, but can't put them in the shopping cart. If you already have things in your shopping cart, you can't checkout and pay. Despite all this, you can see the products, but you can't buy them. Shop time would be as follows: Online: Monday to Sunday from 12 am to 22 pm Offline: the remaining time is to be deactivated Is that possible? I've already found a

Time based Enable/Disable Add to Cart in Woocommerce

帅比萌擦擦* 提交于 2021-02-04 20:48:08
问题 I would like my online shop to be deactivated or activated for a certain period of time. When the shop is deactivated, you can see the products, but can't put them in the shopping cart. If you already have things in your shopping cart, you can't checkout and pay. Despite all this, you can see the products, but you can't buy them. Shop time would be as follows: Online: Monday to Sunday from 12 am to 22 pm Offline: the remaining time is to be deactivated Is that possible? I've already found a

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 postcode shipping field to a dropdown in Woocommerce

老子叫甜甜 提交于 2021-02-04 19:41:21
问题 Im trying to make the postcode field in shipping only to be a select type with my options in woocommerce checkout page: Unsetting shipping state and post code checkout fields add_filter( 'woocommerce_checkout_fields' , 'partial_unsetting_checkout_fields' ); function partial_unsetting_checkout_fields( $fields ) { unset($fields['shipping']['woocommerce_checkout_fields']); return $fields; } Reinserting custom shipping post code checkout field, add_filter( 'woocommerce_checkout_fields' , 'art

Limit woocommerce orders by IP

喜你入骨 提交于 2021-02-04 19:31:21
问题 I need to prevent selling more than 30 items per day by IP address in woocommerce. Basically, it is protection from bots. I think logic must be something like this: get IP of a customer on a purchase and store it in the order meta check if there are other purchases from that IP at the past 24hr if more then 30 - display an error before payment and ask to return later *user registration is disabled So I'm not sure where to start and how to follow to woocommerce hooks rules. Any code examples

Change town/city text field to Select Option field in checkout form

混江龙づ霸主 提交于 2021-02-04 19:15:38
问题 In Woocommerce, I would like to change Town/City text field in a select field option field. What should i do? Here is a screenshot: Thanks 回答1: You need first to change the field type from 'text' to 'select' using the dedicated hook woocommerce_default_address_fields . Then you have also to change the label and to and an options argument where you are going to set your towns in an array of key/values . In this array, you will have a line by town separated by a coma. Here is the code: add

Woocommerce is returning empty array list while fetching shipping methods

别来无恙 提交于 2021-02-04 17:41:24
问题 I am building a custom shipping method plugin for which i need to access shipping method variables . echo "<pre>"; print_r( $woocommerce->shipping->get_shipping_methods); echo"</pre>"; doing this in my plugin is returning an empty set or array while, echo "<pre>"; print_r( $woocommerce->shipping->get_shipping_methods); echo"</pre>"; returns expected value(available shipping methods) any ideas is it due to some kind of error or what ? here is shipping object which am getting --> WC_Shipping