checkout

Replace the city text field by a dropdown of cities for a specific country in Woocommerce

…衆ロ難τιáo~ 提交于 2019-12-02 06:04:45
问题 The existing list of countries is excellent, but we need to select Saudi Arabia in particular and show it another list with the names of the main cities such as Riyadh, Jeddah, etc. The last option is another, and if he selects another, a text box will appear to write the name of the city or region in which it is located. I try this, Its work with me when select Saudi Arabia, i can show list of cities, but I could not do if he selects another, a text box will appear to write the name of the

Percentage discount based on user role and payment method in Woocommerce

巧了我就是萌 提交于 2019-12-02 04:58:11
问题 I was trying to make a code snippet for functions.php which would apply a discount of 2 % for cart totals when the role "subscriber" and the payment method "credit-card" are both selected. My progress so far function discount_when_role_and_payment(/* magic */) { global $woocommerce; if ( /* credit-card selected */ && current_user_can('subscriber') ) { /* get woocommerce cart totals, apply 2% discount and return*/ } return /*cart totals after discount*/; } add_filter( '/* magic */', 'discount

Displaying custom checkout fields based on a selector choice

谁都会走 提交于 2019-12-02 04:26:38
问题 Based on this working answer: Custom dropdown selector showing or hiding other Checkout custom fields In WooCommerce checkout page I use the code below to create some additional custom fields and reorder all the checkout fields. I use a jQuery script to show/hide some fields based on a selector choice. Here is my new code: // Registering external jQuery/JS file function cfields_scripts() { /* IMPORTANT NOTE: For a child theme replace get_template_directory_uri() by get_stylesheet_directory

git使用命令, 特别:git checkout -b a 与 git branch a区别

别等时光非礼了梦想. 提交于 2019-12-02 04:17:44
创建分支: $ git branch mybranch 切换分支: $ git checkout mybranch 创建并切换分支: $ git checkout -b mybranch 更新master主线上的东西到该分支上:$git rebase master 切换到master分支:$git checkout master 更新mybranch分支上的东西到master上:$git rebase mybranch 提交:git commit -a 对最近一次commit的进行修改:git commit -a –amend commit之后,如果想撤销最近一次提交(即退回到上一次版本)并本地保留代码:git reset HEAD^ 合并分支:(merge from) $ git checkout master $ git merge mybranch (merge from mybranch) 删除分支: $ git branch -d mybranch 强制删除分支: $ git branch -D mybranch 列出所有分支: $ git branch 查看各个分支最后一次提交: $ git branch -v 查看哪些分支合并入当前分支: $ git branch –merged 查看哪些分支未合并入当前分支: $ git branch –no-merged

How to checkout and reset using smartgit?

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:00:46
Need help in understanding the below 1). How do i check out to a particular commit and again revert back to the recent commit ? Tried branch->checkout->same branch and check out to the previous commit, but when i did this the commits made after the one i checked out now got lost ! Its not in the list to checkout to recent commit ! 2). How do i reset my head to a particular commit ? (1) Usually, branch refs won't be changed by a Check Out , so you may use Check Out again to switch back to your branch: simply select the corresponding branch for "Showing Branches" selector. If the branch ref to

Required custom WooCommerce checkout fields don't validate entered value

走远了吗. 提交于 2019-12-02 02:57:47
I'm adding WooCommerce custom checkout fields in a Storefront child theme functions.php file. They have a "required" attribute. The aim is to have these fields appear at the top of the page, before the billing fields. when clicking the submit button to proceed to payment, I'm getting the required custom field validation error ('please fill in your name') and can't continue with payment, even though filling the field with valid data. Any clue how to fix this or where to start debugging ? here is the code in functions.php : add_action( 'woocommerce_before_checkout_form', 'my_custom_checkout

Displaying custom checkout fields based on a selector choice

做~自己de王妃 提交于 2019-12-02 02:03:19
Based on this working answer: Custom dropdown selector showing or hiding other Checkout custom fields In WooCommerce checkout page I use the code below to create some additional custom fields and reorder all the checkout fields. I use a jQuery script to show/hide some fields based on a selector choice. Here is my new code: // Registering external jQuery/JS file function cfields_scripts() { /* IMPORTANT NOTE: For a child theme replace get_template_directory_uri() by get_stylesheet_directory_uri() The external cfields.js file goes in a subfolder "js" of your active child theme or theme.*/ wp

Unlink coupon form on Woocommerce checkout page

早过忘川 提交于 2019-12-02 01:11:30
Which file do I need to edit if I don’t want user to click the link to apply the coupon code? In simple, I want no LINK to be clicked on. I want the apply coupon appear below the text "Have a coupon?" so that user can ALWAYS see the section. Updated This can be done very easily using dedicated woocommerce_checkout_coupon_message filter hook: add_filter( 'woocommerce_checkout_coupon_message', 'custom_checkout_coupon_message', 20, 1 ); function custom_checkout_coupon_message( $message ) { ?> <script type='text/javascript'> jQuery(document).ready( function($){ setTimeout(function(){ $('form

Replace the city text field by a dropdown of cities for a specific country in Woocommerce

荒凉一梦 提交于 2019-12-01 23:16:52
The existing list of countries is excellent, but we need to select Saudi Arabia in particular and show it another list with the names of the main cities such as Riyadh, Jeddah, etc. The last option is another, and if he selects another, a text box will appear to write the name of the city or region in which it is located. I try this, Its work with me when select Saudi Arabia, i can show list of cities, but I could not do if he selects another, a text box will appear to write the name of the city or region in which it is located. add_filter( 'woocommerce_default_address_fields' , 'customize

Free shipping depending on weight and on minimal cart amount

[亡魂溺海] 提交于 2019-12-01 17:56:28
With WooCommerce, I need to have Free Shipping over certain amount of 250 except the heavy products that are included in the cart. Does anyone know what i should do? Thanks. This custom code will keep free shipping method and will hide other shipping methods when the cart amount is up to 250 and if products are not heavy (less than 20 kg here)… To not allow Free shipping for orders less than 250, you can set this in woocommerce (see at the end). First you will have to sure that the weight is set in each heavy product (for simple or variables products (in each variations). The cart subtotal