user-data

Add a purchase condition to WooCommerce products

◇◆丶佛笑我妖孽 提交于 2021-02-19 09:13:29
问题 I ma trying to add a purchase condition to my WooCommerce products with the following: {$current_user = wp_get_current_user(); if ( current_user_can('administrator') || wc_customer_bought_product($current_user->email, $current_user->ID, // return true return true;} But I don't know if this code is correct and an advise will be helpful. 回答1: The product Id argument is missing from wc_customer_bought_product() function, and you can get more easily the WP_User object. Here is a usage example:

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

Programmatically created WooCommerce order have no tax for new users

可紊 提交于 2021-02-15 06:51:08
问题 Im using Gravity forms to create an WooCommerce order programmatically. If an email added to the form already exists, it takes the shipping and billing from the users account. This works and it adds the VAT correctly. For a user that is not logged in, they add name, email, phone and country to the form, and the user is created automatically. The order is created, and the user is added. But in this case, the AT is not added and I have to manually recalculate the order for the VAT to be added.

Programmatically created WooCommerce order have no tax for new users

♀尐吖头ヾ 提交于 2021-02-15 06:50:13
问题 Im using Gravity forms to create an WooCommerce order programmatically. If an email added to the form already exists, it takes the shipping and billing from the users account. This works and it adds the VAT correctly. For a user that is not logged in, they add name, email, phone and country to the form, and the user is created automatically. The order is created, and the user is added. But in this case, the AT is not added and I have to manually recalculate the order for the VAT to be added.

Sync additional Billing registration fields with default Wordpress fields in WooCommerce

丶灬走出姿态 提交于 2021-02-07 09:20:33
问题 I Have added the below codes into Woocommerce user registration form to get the Billing Details on the registration page. Now what is happening when a new user register, the first and last name will get registered in the database of billing details & as well as in the default wordpress user account . If the user update his first name & last name on his account (wordpress user account), the same should update on the billing details. Woocommerce settings: Guest checkout is disabled. Checkout

Save filtered billing phone to admin user profile in WooCommerce

谁说胖子不能爱 提交于 2021-01-28 12:19:15
问题 Everything I have read over the last couple of days has indicated that if I want to save fields in the user-edit.php (User Admin Backend), I should be using the edit_user_profile_update & personal_options_update hooks (and I'm not including the validation hook in this question...) In the codex, they state that: Consider an example: update_user_meta($user_id, 'custom_meta_key', $_POST['custom_meta_key']); Make doubly sure that you give a different key name for the $_POST data key and the

How to automatically create an account if a product in the order belongs to a certain category in WooCommerce

↘锁芯ラ 提交于 2021-01-28 05:54:35
问题 I have a WooCommerce shop where customers checkout as guests. I now want to sell a couple of virtual products and in that case I want to auto create an account. So I have two working code snippets. One to check if a product in cart is within a specific category (online) One to auto create an account from guest checkout. But I can't figure out how to combine these two so they work together. Or is it a better solution for this? Any ideas? Here is the two code snippets I started with and then

Add birthday field to my account and admin user page

浪尽此生 提交于 2021-01-05 08:39:04
问题 I have added the code below. The birthday field is showing in my account page and also in WP admin user page as well but the problem is that the date is not saving . What I have so far function iconic_get_account_fields() { return apply_filters( 'iconic_account_fields', array( 'user_url' => array( 'type' => 'date', 'label' => __( 'My Birth Date', 'iconic' ), 'placeholder' => __( 'Date of Birth', 'iconic' ), 'required' => true, ), ) ); } /** * Add fields to registration form and account area.