custom-fields

WooCommerce - Overriding billing state and post code on existing checkout fields

寵の児 提交于 2019-11-28 11:47:55
I can't find the way to ovveride billing state and post code. How can I edit the other parts of existing billing fields like billing state and post code? This is what I have in the functions.php file in my child theme (I have included the code affecting the billing part): <?php function my_custom_checkout_field( $checkout ) { global $wpdb; $check_zone = $wpdb->get_results("select area_name from brick_area where id='".$_SESSION['area']."'",ARRAY_A); if(!empty($check_zone)){ $check_zoneid = $check_zone['0']; } woocommerce_form_field( 'my_field_name', array( 'type' => 'text', 'class' => array('my

Adding custom emails to BCC for specific Woocommerce email notifications

依然范特西╮ 提交于 2019-11-28 11:29:22
问题 In Woocommerce, I have a custom email template (id = 'wc_course_order') that sends when a specific product (an online course) is purchased. Below I use a hooked function that adds recipients based on order metadata from custom fields (i.e. "Student Email"). It's based on this thread answer. How can I add these recipients as BCC and grab their "First Name" field and add that to the body of the email, especially given that two quantities of the course product may be purchased together with two

Add and save admin product variations custom field in Woocommerce

醉酒当歌 提交于 2019-11-28 09:47:03
问题 So I've got the following code which makes me add a Barcode field to the Inventory Options of a product. Now I also want to add this to each variations so I can easily add Variation Products when I scan the Barcode of the product via the WooCommerce Point of Sale plugin. Here is what I got currently: // Add Barcode field in simple product inventory options add_action('woocommerce_product_options_sku','add_barcode',10,0); function add_barcode(){ global $woocommerce,$post; woocommerce_wp_text

Adding custom field to product category in WooCommerce

◇◆丶佛笑我妖孽 提交于 2019-11-28 09:06:42
How can I add custom fields to product category? I have added custom field to product but I cant find any extension which provide facility to add custom field to product category. Please help You can add custom fields to WooCommerce product category by using following action : product_cat_add_form_fields product_cat_edit_form_fields edited_product_cat create_product_cat UPDATED on 17-Feb-2017 For WP version 4.4 and above. As of WordPress 4.4, update_term_meta() and get_term_meta() functions have been added. This means that now we don't have to save the data in wp_options table anymore, rather

Cart item price calculation, based on chosen “days” custom field in Woocommerce

坚强是说给别人听的谎言 提交于 2019-11-28 07:48:37
问题 In Woocommerce, I use custom fields to calculate the price of a product, based on this thread code: Display product custom fields as order items in Woocommerce 3. // Add a custom field before single add to cart add_action('woocommerce_before_add_to_cart_button', 'custom_product_price_field', 5); function custom_product_price_field() { echo '<div class="custom-text text"> <h3>Rental</h3> <label>Start Date:</label> <input type="date" name="rental_date" value="" class="rental_date" /> <label

Admin product pages custom field displayed in Cart and checkout

╄→尐↘猪︶ㄣ 提交于 2019-11-28 01:58:58
I have created a Custom Field in WooCommerce Admin on the general settings tab of product pages, to insert a some days for manufacture. I would like to show this custom field value on cart and checkout pages above the name of each product. Here is my code: // Insert a Custom Admin Field function woo_add_custom_general_fields() { echo '<div class="options_group">'; woocommerce_wp_text_input( array( 'id' => 'days_manufacture', 'label' => __( 'Days for Manufacture', 'woocommerce' ), 'placeholder' => '', 'description' => __( 'Insert here', 'woocommerce' ), 'type' => 'number', 'custom_attributes' =

Change cart item prices based on custom cart item data in Woocommerce

给你一囗甜甜゛ 提交于 2019-11-27 08:06:29
问题 currently i create a form in product single page so that customer can enter height and width of the product . So the product price vary based on the entered height and width . I created this form in woocommerce->single-product->add-to-cart->simple.php Before modification the form is <form class="cart" method="post" enctype='multipart/form-data'> <?php /** * @since 2.1.0. */ do_action( 'woocommerce_before_add_to_cart_button' ); /** * @since 3.0.0. */ do_action( 'woocommerce_before_add_to_cart

Adding an additional custom field in Woocommerce Edit Account page

对着背影说爱祢 提交于 2019-11-27 07:36:44
问题 IN WooCommerce, I have been able to add a custom fields in Edit Account page. I have tried adding a 2nd custom field "Favorite Color 2" but I ca't get it working, There is something that I am doing wrong. How I can make to add/save an additional custom field in Edit Account page? // Add the custom field "favorite_color" add_action( 'woocommerce_edit_account_form', 'add_favorite_color_to_edit_account_form' ); function add_favorite_color_to_edit_account_form() { $user = wp_get_current_user(); ?

Adding user custom field value to order items details

ⅰ亾dé卋堺 提交于 2019-11-27 07:13:10
问题 Developing a WooCommerce webshop with vendors (WC Vendors). I need to display a custom field that I have created in vendors profile. It shoud be displayed under the item and vendor name in order-details.php . How to display profile field by that seller/vendor id? Anybody could help me? Here's a screenshot of what I would lie to have: Profile Custom Fields Adding custom fields to user profile page add_action( 'show_user_profile', 'wp_added_user_profile_fields' ); function wp_added_user_profile

wordpress - make custom field values clickable to retrive them later

时光怂恿深爱的人放手 提交于 2019-11-27 05:41:13
I want to add a custom column to my the all posts page of admin panel in wordpress. The scenario is - every post has a featured image. When I look at the all posts page in admin panel, then I have a custom column namely '*' and it has the value * in every row. I want to click the column value for a particular row to make it selected and have a different look (i.e. bold font). Then in the homepage I'll try to retrieve the featured image of those posts for which the custom column value has been selected by clicking on it. I followed this tutorial and added the following code in the theme's