checkout

Set a minimal order amount for a specific User role in Woocommerce

你。 提交于 2019-12-06 09:14:09
问题 I'm creating a wholesale website. Looking on here I was able to already find code for switching between two user roles after customers place a first order. Now I just need to be able to set minimum order amounts for different user roles on the cart/checkout page and most of what I've been finding does way more than I need it to. Searching online I was able to find this bit of code: <?php /* Author: Doug Edgington Description: Require a minimum order total in Woocommerce for a user role */

Stop the redirection after WooCommerce add to cart

China☆狼群 提交于 2019-12-06 08:46:16
I wish to completely remove any redirection after a user click on the ADD TO CART button. Actually I am not using the products page. I am using a simple button with the link to the product, like this: ?add-to-cart=492 . My user will click on several "add to cart" buttons on my page, so he cant be redirected to any page after clicking in the first button. At the end of the page he will find a CHECKOUT button to pay and that is it. Any ideas how to achieve this? Thanks Update: Your simple html "add-to-cart" button links are actually for example like that (the href value) : <a href="http://my

Display Custom Field's Value in Woocommerce Cart & Checkout items

被刻印的时光 ゝ 提交于 2019-12-06 08:42:40
问题 I have been looking for a solution for a while all over internet but couldn't find any proper solution. I am using several custom fields in my product page like, 'Minimum-Cooking-Time', 'Food-Availability' etc. So, I like to show this custom field's value in my cart and checkout page. I tried snippets in function file and editing woocommerce cart file too. I have tried several codes but they are not pulling any data from my custom fields. As you can see in the screenshot below, I want to show

Display custom checkout field value in Woocommerce admin order edit pages

亡梦爱人 提交于 2019-12-06 06:30:29
I have the function in functions.php: // Hook in add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); // Our hooked in function - $fields is passed via the filter! function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_infos'] = array( 'type' => 'textarea', 'label' => __('Podaj NIP', 'woocommerce'), 'placeholder' => _x('Tutaj możesz wpisać NIP', 'placeholder', 'woocommerce'), 'required' => false, 'class' => array('form-row-wide'), 'clear' => true ); return $fields; } This code is adding custom field to billing form. It's working fine

Adding a hidden fields to checkout and process it through order

你离开我真会死。 提交于 2019-12-06 06:24:27
问题 I would like to add an verification code to the checkout process that is read-only ( or invisible) and pre-filled, pinned on an order. The Customer Need this Code to verifiy the Order. I add a custom Array to the Billing Field at the woocommerce_checkout_fields filter: //VID $fields['billing']['billing_vid'] = array( 'label' => __('', 'woocommerce'), 'placeholder' => _x('', 'placeholder', 'woocommerce'), 'required' => false, 'type' => 'text', 'class' => array('form-row-wide'), 'clear' =>

WooCommerce dynamic minimum order amount based fee

跟風遠走 提交于 2019-12-06 04:16:49
I need to set a minimum order fee in the shopping cart so if products in the cart don't total more than £10 then an extra fee is applied to bring the price up to £10. Here is the code I have at the moment which works well in the cart phase however when you reach the checkout the pricing section doesn't stop loading for some reason and you can't checkout, can anyone help? Code from functions.php: function woocommerce_custom_surcharge() { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $minimumprice = 10; $currentprice = $woocommerce->cart->cart_contents_total;

Tax class “Zero rate” per user role on specific product ID's

て烟熏妆下的殇ゞ 提交于 2019-12-06 04:11:39
I got this code that will apply tax free on a user role regardless of what they order, which is fine. But now I need another user role that will apply tax free on specific products id , and I'm not sure how to acomplish that. The code im using right now for tax free on all products for specific user role is: // Apply a different tax rate based on the user role. function wc_diff_rate_for_user( $tax_class, $product ) { // Getting the current user $current_user = wp_get_current_user(); $current_user_data = get_userdata($current_user->ID); if ( in_array( 'administrator', $current_user_data->roles

WooCommerce Custom Field in Checkout

孤人 提交于 2019-12-06 04:10:43
问题 I want add Custom field in WooCommerce checkout page but for selected products. For e.g if Client have Product A in cart only than this custom field should appear in WooCommerce Checkout Page I am using following code in functions.php to add custom field: add_action('woocommerce_before_order_notes', 'my_delivery_checkout_field'); function my_delivery_checkout_field( $checkout ) { echo '<div id="my_local_club"><h3>'.__('Delivery Options').'</h3>'; woocommerce_form_field( 'delivery_options',

Woocommerce: Set checkout field values

大憨熊 提交于 2019-12-06 03:13:22
问题 For a special group of customers that aren't yet WP user in my system, I am directing them to a special page, where they'll choose from a limited set of products. I already have all of their information and I it's going to pre-populate on this landing page. When they've verified their information, it will add their product to the cart and skip straight to the checkout. I've got all that down so far. What I want to do is pre-populate the checkout data with the customer name and billing

WooCommerce: How to retain checkout info when client leaves then comes back?

混江龙づ霸主 提交于 2019-12-05 20:39:28
问题 Is there a simple way or a plugin to retain checkout information entered by the client after he/she leaves and comes back? This plugin retains "fields information for customers when they navigate back and forth" however it has quite a lot of recent bad reviews so I don't think I'll use that for production. Any alternative suggestion? 回答1: ---- Update ---- The code below is working, but only if data is submitted! The only possible ways are javascript/jQuery form event detection on checkout