custom-fields

Styling custom fields added in the backend in WooCommerce

让人想犯罪 __ 提交于 2020-07-31 04:27:05
问题 I've added a custom field, and I want the label text to start on a new line. At the moment it starts between to price fields. Can I style it? or cant I change the priority to move it to another line? I am using: WooCommerce: Get custom field from product variations and display it as a suffix to variation prices 回答1: You could add a wrapper class 'wrapper_class' => 'form-row-full', For the wrapper_class are the other possibilities: form-row-first - 50% of the width, left form-row-last - 50% of

Conditional custom checkout fields based on product category in Woocommerce

主宰稳场 提交于 2020-06-15 06:42:49
问题 I am using woocommerce for a site for a nonprofit that sells tickets to classes and tickets to events. When someone is signing up for a class then need to list their emergency contact information and agree to a liability release. When they are buying a ticket to an event the nonprofit doesn't need the emergency contact info or the liability release. So... they want those fields to appear on the woocommerce checkout only on the condition that the person is checking out with a ticket for a

Append custom field value in WooCommerce product name on cart and checkout

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-23 05:05:13
问题 I'm trying to change the name of the product in cart and checkout pages. I have the following code to add some cart meta data: function render_meta_on_cart_and_checkout( $cart_data, $cart_item = null ) { $custom_items = array(); /* Woo 2.4.2 updates */ if( !empty( $cart_data ) ) { $custom_items = $cart_data; } if( isset( $cart_item['sample_name'] ) ) { $custom_items[] = array( "name" => $cart_item['sample_name'], "value" => $cart_item['sample_value'] ); } return $custom_items; } add_filter(

Include custom fields value in woocommerce search

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-22 07:21:24
问题 I tried include custom fields value in woocommerce search but i have a problem. On Google and Stack too, i saw examples with pre_get_posts, so i thought this is good direction and i made code like this: function custom_search( $query ) { if( ! is_admin() && $query->is_main_query() ) { if ( $query->is_search() ) { $meta_query = array( 'key' => 'custom_color', 'value' => $query->query['s'], 'compare' => 'LIKE' ); $query->set( 'meta_query', $meta_query ); } } } add_action( 'pre_get_posts' ,

ACF repeater based on product quantity generating checkout fields in Woocommerce

守給你的承諾、 提交于 2020-02-21 10:11:15
问题 I am using woocommerce-advanced-checkout-fields plugin and added a repeater field to the billing section as follows As you can see in the image above the repeater field "Name/Email" is applicable to the product "Belt" Now when I go to buy the product from the store and make the quantity 3 as follows the repeater field is shown 3 times and all is good to the point. Now when I place the order the landing page does not carry the values I entered as follows Also, the values are not showing in the

ACF repeater based on product quantity generating checkout fields in Woocommerce

大憨熊 提交于 2020-02-21 10:11:03
问题 I am using woocommerce-advanced-checkout-fields plugin and added a repeater field to the billing section as follows As you can see in the image above the repeater field "Name/Email" is applicable to the product "Belt" Now when I go to buy the product from the store and make the quantity 3 as follows the repeater field is shown 3 times and all is good to the point. Now when I place the order the landing page does not carry the values I entered as follows Also, the values are not showing in the

Get product custom field values as variables in WooCommerce

我只是一个虾纸丫 提交于 2020-02-20 08:57:34
问题 I am using Woocommerce for registration for classes; each class/product has up to 20 custom fields, which I need to return as variables in order to highly customize the checkout and order details pages and customer email template. I don't just want to add all of the custom meta data with hooks, because I need very tight control over the output. For instance, the following answer worked fine for including custom fields in the cart page: Display Custom Field's Value in Woocommerce Cart &

wordpress featured posts

时光怂恿深爱的人放手 提交于 2020-02-06 06:55:45
问题 i'm trying to create a portfolio website using wordpress, each post has view costum fields, one of which is called type - with the value of "featured" or "not-featured" now when user clicks on the post title - they go the the single.php to see the entire post, here i would love to display all featured thumbnails i tried this <?php while ( have_posts() ) : the_post() ?> <?php if(get_post_meta($post->ID, 'type', true) == "featured") {; ?> <h2 class="entry-title"><a href="<?php the_permalink();

wordpress featured posts

左心房为你撑大大i 提交于 2020-02-06 06:53:07
问题 i'm trying to create a portfolio website using wordpress, each post has view costum fields, one of which is called type - with the value of "featured" or "not-featured" now when user clicks on the post title - they go the the single.php to see the entire post, here i would love to display all featured thumbnails i tried this <?php while ( have_posts() ) : the_post() ?> <?php if(get_post_meta($post->ID, 'type', true) == "featured") {; ?> <h2 class="entry-title"><a href="<?php the_permalink();

Translate custom labels fields in function.php file of my theme

守給你的承諾、 提交于 2020-01-21 11:43:29
问题 With the help from the community, I have succeeded to create, save and print the labels and their values to the single product page. I can also translate the input values into different languages using Polylang , but translating the custom labels (Conditions and Brands) is extremely hard. Anyone out there can help me with these issues? I tried to use Polylang , Saywhat ...with no success! Here is the code: // Enabling and Displaying Fields in backend add_action( 'woocommerce_product_options