checkout

Set minimum allowed weight for a specific country in WooCommerce

独自空忆成欢 提交于 2019-11-30 19:20:26
问题 I am trying to specifically apply a mandatory minimum weight of 20 kilos for the country of Colombia avoiding checkout if the total cart weight is under this minimal weight. Here is my actual code, that allow me to fix a minimum weight: add_action( 'woocommerce_check_cart_items', 'cldws_set_weight_requirements' ); function cldws_set_weight_requirements() { // Only run in the Cart or Checkout pages if( is_cart() || is_checkout() ) { global $woocommerce; // Set the minimum weight before

WooCommerce - Checkout conditional fields for different persons custom status

与世无争的帅哥 提交于 2019-11-30 18:10:09
问题 I need to modify the checkout process for an woocommere website. The process is determinated by the status of the person that could be one of this: - 'legal entity' - 'individual' I need to have a selector 'User status' (or radio buttons) , just after the 'billing_first_name' and 'billing_last_name'. The selector should work this way: If 'legal entity' is selected, it should display 3 fields: 'phone_number' 'email' 'serial_id' If 'individual' is selected, it should display 3 other fields:

Show or Hide two checkout fields in Woocommerce

爷,独闯天下 提交于 2019-11-30 09:37:32
问题 In Woocommerce checkout form im trying to hide billing_city and billing_address_1 fields first and after I fill the fields postcode and housenumber the other fields (address_1 and city) has to show. This is the script, but I does not work well and I dont know what I do wrong: ?> <script type="text/javascript"> jQuery('input#billing_housenumber').change(function(){ if (this.checked) { jQuery('#billing_city').fadeIn(); jQuery('#billing_city input').val(''); } else { jQuery('#billing_city')

How to make Woocommerce not to save Checkout billing fields

試著忘記壹切 提交于 2019-11-30 07:38:57
问题 I have a particular case where I need many people to login to ONE specially created user (one login name and one password for all) and purchase items through it. The problem is if Person A logins with this ONE user credentials and makes a purchase he will leave a trace in shipping/billing details, person B will then see those details when in checkout page. Woocommerce saves those details by default, how could I disable that? How can I make Woocommerce Chechout page to always have empty fields

Add a new custom checkout field before billing details in Woocommerce?

血红的双手。 提交于 2019-11-30 00:08:04
问题 I can add a set of custom fields to my WooCommerce checkout screen but need to move it above the 'Billing Details'. How can that be done? According to this official WooCommerce documentation, here is an example code to add extra custom checkout fields: /** * Add the field to the checkout */ add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); function my_custom_checkout_field( $checkout ) { echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>';

stripe checkout custom button not charging

吃可爱长大的小学妹 提交于 2019-11-29 21:51:25
问题 I am trying to get Stripe's Checkout Custom Button to charge a credit card but all it does is minimize after I enter the credit card details. I am using the code found in the documentation but I can't get it to work. The simple button is easy to use and I figured it would be as easy as just customizing that one but it's very different. Here's the code: Payment Page <form action="charge.php" method="post"> <script src="https://checkout.stripe.com/checkout.js"></script> <input type="submit"

Custom validation of WooCommerce checkout fields

Deadly 提交于 2019-11-29 18:40:26
问题 I would like add my own regular expression for validating the phone number. In my class-wc-validation.php I have changed the regular expression to my requirement. public static function is_phone( $phone ) { //if ( strlen( trim( preg_replace( '/[\s\#0-9_\-\+\(\)]/', '', $phone ) ) ) > 0 ) if ( strlen( trim( preg_replace( '/^[6789]\d{9}$/', '', $phone ) ) ) > 0 ) return false; return true; } But the validation is not happening. What am I missing? 回答1: I have not seen your code that hooks these

《Git权威指南》读书笔记 第八章 Git检出(checkout)

孤者浪人 提交于 2019-11-29 17:46:21
重置命令(git reset)主要用于修改master引用指向的提交ID,修改过程中HEAD的指向并没有改变(一致指向/refs/heads/master,而这个master被git reset命令改变)。 相对的Git检出命令(git checkout)会改变HEAD本身的指向,而不会影响分支游标(master)。 8.1 HEAD的重置就是检出 HEAD可以理解为“头指针”。查看HEAD的指向: $ cat .git/HEAD ref: refs/heads/master 可以看出HEAD指向了分支master。执行git branch会看到当前处于master分支: $ git branch -v * master 1ce417a does master follow this new commit? 使用git checkout 检出该ID的父提交: $ git checkout 1ce417a^ Note: checking out '1ce417a^'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without

WooCommerce conditional custom checkout fields

ぃ、小莉子 提交于 2019-11-29 17:02:12
In WooCommerce, I'm currently trying to add a conditional custom field in the Checkout that shows a checkbox which if is checked displays an input field to insert an italian fiscal code (Codice Fiscale). Thanks to various guides and plugin codes I was able to show it in the checkout but i'm doing something wrong with the code and having several issues: By default i would like it to be NON required field, only if its checked it must become required. If i try to proceed to cart inserting a valid or non codice fiscale i get this error "SyntaxError: Unexpected token < in JSON at position 0" where

WooCommerce login redirect based on cart

ε祈祈猫儿з 提交于 2019-11-29 16:32:53
I want to apply following 2 case : If User not logged in and cart is empty: Then redirect user to login and then my account If User not logged in and cart has product: Then redirect user to login and after login redirect to checkout My Code : function wpse_Nologin_redirect() { if ( ! is_user_logged_in() && (is_checkout()) ) { // feel free to customize the following line to suit your needs $MyLoginURL = "http://example.in/my-account/"; wp_redirect($MyLoginURL); exit; } } add_action('template_redirect', 'wpse_Nologin_redirect'); Above code is working fine for my first case. But for my second