Support

Account

Home Forums Search Search Results for 'woocommerce'

Search Results for 'woocommerce'

topic

  • Helping

    Date front end display format

    I’m struggling to convert an ACF date picker field to be displayed in the correct format on the front end.

    I’m using this snippet to display the 2 product custom fields on the order confirmation and the associated email.

    add_action( 'woocommerce_order_item_meta_start', 'order_item_meta_start', 10, 4 );
    function order_item_meta_start($item_id, $item, $order, $plain_text) {
    	$the_order_id = $order->get_id();
    	$order_items = $order->get_items();
    	$custom_field_variable1 = get_post_meta( $item->get_product_id(), 'competition_reference', true ); // Change custom_field_name to the name of your custom product meta field
    	$custom_field_variable2 = get_post_meta( $item->get_product_id(), 'competition_draw_date', true ); // Change custom_field_name to the name of your custom product meta field
    	echo '<p>Competition Reference: ' . $custom_field_variable1 . '<br>Competition Draw Date: ' . $custom_field_variable2 . '</p>';
    }

    It works in the fact it displayed the ACF data, but it displays the date as YYYYMMDD rather than my ACF return format of dd/mm/YYYY

    Product
    LEGO® Star Wars™ Darth Vader Helmet (75304)
    Competition Reference: LegoDV_001
    Competition Draw Date: 20230630

    How can I return the date correctly?

  • Unread

    ACF wooCommerce UPC codes

    I need to display UPC codes in our wooCommerce store. I need to add UPC codes for simple products and also for variable products. Not sure how to even start or where to start. Hoping someone here can start me off.

    Any help would be appreciated.
    Thanks in advance
    Vince

  • Unread

    Applying category values to products automatically

    I’m not sure, if ACF is able to create a scenario I’m planning – that’s the cause of the question:

    I will have a field group, each field have an own value set (field 1: a,b,c; field 2: 123,456,789; field 3: eur,gbp,usd).

    I want to apply certain combination of field values in this group (field 1: a; field 2: 123; field 3: eur;) to certain Woocommerce category.

    How to apply same fields and their values to all products in this category? All means currently existing and added in the future.

    Example: all Woocommerce categories have field group “watch properties” with fields “diameter” and “thickness”. Category “Swatch Skin” has fields values like “diameter: 30mm”, “thickness: 2mm”. Category view displays both fields and values and the values are searchable with any ACF search plugin.

    Now I add to this category some affiliate products – fields and values “diameter: 30mm” and “thickness: 2mm” will be automatically applied to them. Searching in products is not mandatory.

    What do you think about getting this scenario done?

  • Solving

    Compare Products

    I would like to create on my Website with Avada Theme installed a Compare Products if possible without using Woocommerce. It need only to view differents tech specs about our product.
    I link to you a website like example with a section compare products that wi would like to replicate.

    https://www.huddly.com/conference-cameras/

    It is possible with your plugin?

    Let me know
    Thanks

  • Helping

    removing existing fields from registration form

    I have a new registration form for WooCommerce which contains an email address field in the correct place I want it to appear in the new form.

    However WooCommerce seems to add its own email address field below by own new form.

    Is there a way to disable the original field and simply use the new one that I created in the ACF form?

  • Unread

    ACF Pro for Custom Woocommerce Free Gifts

    I want to create personalized gifts offered to customers based on the amount they have when completing an order, is this possible using ACF Pro and if something similar has been used before

    Thank you

  • Unread

    ACF and WooCommerce Shop Page

    I use ACF prugin for WooCommerce child theme
    I try to create fields for yourtheme/woocommerce/content-product.php page.
    I need to show image with text for product listing and categories

    So I created Shop Field Group – Shop page image and text

    For Shop image:
    field type = image
    field name = shop_page_image
    return format = image url
    library = all

    Location rules
    Show this field group if
    page is equal to Shop ( I have page for WooCommerce shop page in backend )
    or
    page is equal to Home ( add it for testing )

    I can add image to Shop page and Home using WordPress edit page
    And if I try to show image using this

    <?php $shop_image = get_field('shop_page_image');
      var_dump($shop_image);
    ?>

    or

    <?php 
    $image = get_field('shop_page_image');
    if( !empty($image) ): ?>
       <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
    <?php endif; ?>

    I get NULL for Shop page but I get image url for Home page. How to get field on Shop page too?
    I have child theme and WooCommerce folder in child theme has 2 files – archive-product.php and content-product.php

  • Solving

    ACF not showing in WooCommerce Rest API

    Hi community 👋

    I have an ACF Field Group for WooCommerce Products that is used to show information on the product page. This ACF Field Group has the Show in REST API enabled.

    However, when I access it through the API, I can’t see anything from ACF.

    https://domain.com/wp-json/wc/v3/products/3644

    Is there anything I’m doing wrong, is there any workaround or something I can do? The information there is very important.

    Really thank you! 😊

  • Solving

    Display value of attribute from ACF field group

    Hi

    I have setup an ACF field group with multiple fields (Text and Taxonomy). I want to show the value of a field in the product (WooCommerce).

    With the text fields, it works like this:
    get_field('myfield')

    But with the taxonomy fields, I just get the ID of the attribute.

    How can I display the value set in the product on this attribute instead of the ID?

  • Solving

    API Error Received

    Hello to all forum members, I am hoping you can please help me, I have only recently started to use ACF to add content to my woocommerce single product template which works well when I import new products using csv import, I am currently using the free version (but obviously planning to upgrade!).

    We are now trying to add new products by automation using api, when importing we get the system fields populated but none of the ACF fields data is added and we receive an error?

    This is the error we receive:

    {“code”:”rest_invalid_param”,”message”:”Invalid parameter(s): meta_data”,”data”:{“status”:400,”params”:{“meta_data”:”meta_data[0] is not of type object.”},”details”:{“meta_data”:{“code”:”rest_invalid_type”,”message”:”meta_data[0] is not of type object.”,”data”:{“param”:”meta_data[0]”}}}}}

    If we create products without meta_data fields (ACF Fields), then It seems to perfectly create a new product.

    I have also added here an attachment, I attach the error screenshot.

    Many thanks for any help or guidance, we look forward to hearing from you.

  • Helping

    Importing Data into ACF Fields using API Error Received

    Hello to all forum members, I am hoping you can please help me, I have only recently started to use ACF to add content to my woocommerce single product template which works well when I import new products using csv import, I am currently using the free version (but obviously planning to upgrade!).

    We are now trying to add new products by automation using api, when importing we get the system fields populated but none of the ACF fields data is added and we receive an error?

    This is the error we receive:

    {“code”:”rest_invalid_param”,”message”:”Invalid parameter(s): meta_data”,”data”:{“status”:400,”params”:{“meta_data”:”meta_data[0] is not of type object.”},”details”:{“meta_data”:{“code”:”rest_invalid_type”,”message”:”meta_data[0] is not of type object.”,”data”:{“param”:”meta_data[0]”}}}}}

    If we create products without meta_data fields (ACF Fields), then It seems to perfectly create a new product.

    I have also added here an attachment, I attach the error screenshot.

    Many thanks for any help or guidance, we look forward to hearing from you.

  • Solved

    ACF Field default value from another ACF field

    Hi,

    In our WooCommmerce store we have a custom taxonomy called Brand. Under the Brand taxonomy there is an ACF field called Shipping Time.

    I would like to create another Shipping Timem ACF for WooCommerce products and populate it’s default value from the assigned brands Shipping Time ACF field.

    Is that somehow possible?

  • Solving

    Show the values of a field on the front end in a list

    Hi All 🙂

    I am a beginner to this and am after adding the values of some of the fields I have created for Woocommerce products on the front end in a custom information tab.

    I have created the addition info tab in the functions.php file.

    Now, to get the info I need into this tab.

    I can show a field in the field set by using the following

    echo the_field('location');

    But, I want to do these as

    • etc like this

      So, how to I insert html into the echo?

      Like

      echo '<li>Location Title : the_field('location')</li>';

      So, on the front end would be

    • Location Title : location
    • trying all sorts here and dont have the time to go back to school and learn the basics of PHP LOL

      Cheers

  • Solved

    Query for Taxonomy with ACF User Field

    Hello,

    I’m hoping to get my hands on a custom query that will show only WooCommerce products in a category that are assigned to a User using the ACF User field.

    For instance, there is a Product category named “Category X,” and in the User custom field that appears on its Product category settings page, I selected “User X,” creating a relationship between the “Category X” and “User X.”

    Now I need a query to show only the products (in “Category X”) for “User X” when they are logged in. This query needs to work for any particular user (I will be assigning different product categories to different users).

    I’m trying to use Dynamic.ooo to set this query, but unfortunately the options don’t allow it, so it must be custom.

    Preferred Query ID: user_category

    ACF Settings:
    Field Type: User
    Field name: category_user
    Filter By Role: Customer
    Return Format: User Array (or whatever works best)
    Show this field group if: Taxonomy is equal to Category (product_cat)

    I tried the below but it is not working:

    $args = array(
        'posts_per_page' => -1,
        'post_type' => 'product',
        'taxonomy' => 'product_cat',
        //Tries to show products from categories where current user ID is the same as the category_user field
        'meta_query' => array(
          array(
            'key' => 'category_user',
            'value' => $current_user->ID,
            'compare' => 'LIKE'
          )
        )
      );
  • Solving

    Custom Query: Product Category > User Field

    Hello,

    I’m an ACF pro customer and I’m hoping to get my hands on a custom query that will show only WooCommerce products in a category that are assigned to a User using the ACF User field.

    For instance, there is a Product category named “Category X,” and in the User custom field that appears on its Product category settings page, I selected “User X,” creating a relationship between the “Category X” and “User X.”

    Now I need a query to show only the products (“Category X) for “User X” when they are logged in. This query needs to work for any particular user (I will be assigning different product categories to different users).

    I’m trying to use Dynamic.ooo to set this query, but unfortunately the options don’t allow it, so it must be custom.

    Preferred Query ID: user_category

    ACF Settings:
    Field Type: User
    Filter By Role: Customer
    Return Format: User Array (or whatever works best)
    Show this field group if: Taxonomy is equal to Category (product_cat)

  • Solved

    Relationship field showing "No matches found" with WPML

    Hi

    I have a similar problem as described here.

    Wordpress 6.1.1 – latest
    ACF Pro 6.0.7 – latest
    WooCommerce 7.4.1 – latest
    WPML Multilingual CMS 4.5.14 – latest

    I have an options-page where I can set a featured prodct and some selected bestsellers. This fields are done with ACF Post Object for the featured product and with ACF Relationship for the bestsellers.

    Main problem is, that my page is multilingual but not the products. the products are in german only. For this I have set the “Post Type Translation” in WPML for the Post-Type product to “Translatable – use translation if availlable or fallback to default language”. With this setting I can reach my products in all languages even though thea are not translated.

    Now on my options-page I can select products on my default language (german).
    When I change to another language (En and Fr) there ist a message that says “No matches found” and I am not able to choose products for that Post Type.

    What am I missing?
    Does anyone has an idea where to search and what I can try to select products made in another language?

    best regards
    roman

  • Unread

    ACF field for shipping zone

    Hello,

    Is it possible to set an ACF field for a WooCommerce Shipping zone? If possible, how can I achieve that?

    Kind regards,

  • Solved

    How to auto-populate WPForms 'Dynamic Post Type Source' dropdown with a list of

    I have ACF Fields setup for Post Type while using WooCommerce. Each single Product has unique ACF Fields such as {“location”} value and {“brochure”} value.

    I would like to use WPForms’Dynamic Post Type Source’ to create a dropdown list that autopopulates dynamic choices based on the values of these ACF Fields, And ideally only for Products that are In-Stock to reduce size of dropdown list.

    DROPDOWN LIST:
    Location 1 – Brochure URL
    Location 2 – Brochure URL
    Location 3 – Brochure URL
    Location 4 – Brochure URL
    etc

    I understand within Advanced settings, Dynamic Choices can be selected for Post Type or Taxomny, but I’m not sure how this can be achieved with ACF Field Values.

    The only workaround I have found so far is by adding custom WordPress taxonomy that is only related to products. It would act and show just like categories and tags do and show up on the Products page, which would allow the ability to select it from the Dynamic Choices inside WPForms. However, the major limitation here is that I would need to add the taxonomy to every single existing product, and it doesn’t consider stock status.

        function add_custom_taxonomies() {
          // Add new "Locations" taxonomy to Posts
          register_taxonomy('location', 'product', array(
            // Hierarchical taxonomy (like categories)
            'hierarchical' => true,
            // This array of options controls the labels displayed in the WordPress Admin UI
            'labels' => array(
              'name' => _x( 'Locations', 'taxonomy general name' ),
              'singular_name' => _x( 'Location', 'taxonomy singular name' ),
              'search_items' =>  __( 'Search Locations' ),
              'all_items' => __( 'All Locations' ),
              'parent_item' => __( 'Parent Location' ),
              'parent_item_colon' => __( 'Parent Location:' ),
              'edit_item' => __( 'Edit Location' ),
              'update_item' => __( 'Update Location' ),
              'add_new_item' => __( 'Add New Location' ),
              'new_item_name' => __( 'New Location Name' ),
              'menu_name' => __( 'Locations' ),
            ),
            // Control the slugs used for this taxonomy
            'rewrite' => array(
              'slug' => 'locations', // This controls the base slug that will display before each term
              'with_front' => false, // Don't display the category base before "/locations/"
              'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
            ),
          ));
        }
        add_action( 'init', 'add_custom_taxonomies', 0 );
  • Helping

    How can i query acf products by category

    Hello,
    i have created products and product categories with ACF. I dont use Woocommerce and build it with acf fields.

    I use Breakdance Builder and want to query all products per specific category. So i created a template for my product archives but it shows all products from all product categories and not the specific iam on, like sneakers.

    I can insert a query which is atm.

    return [‘post_type’ => ‘products’];

    Can you please help me how i can query products by category.

    best regards

  • Solving

    acf_form() – action when repeater row added or updated

    Hey all,

    So, I have a repeater field which my site users will be able to use on the frontend using acf_form() to add rows to the repeater. This form appears on a WooCommerce order details page

    Form works fine, rows get added etc and saved to the order. Cool.

    Now, one of the fields in the repeater is an email address. Here’s what I’m hoping I can get to happen:

    1. User adds rows to the repeater on the frontend and submits the acf_form()
    2. When the repeater is saved OR updated on the frontend, the email addresses in the email sub field get an email notification (I can format the email myself later), but only the updated rows/fields

    This action needs to be triggered EVERY TIME the form is changed and submitted on the frontend

    Hopefully this is possible

    Here’s kind of what I have from another support post I stumbled on from Google:

    function delegate_form_update($value, $post_id, $field) {
    
    	// only do it to certain custom fields
    	if($field['name'] == 'ticket_alloc') { // ticket_alloc is the name of the repeater
    
    		// get the old (saved) value
    		$old_value = get_field('ticket_alloc', $post_id);
    
    		// get the new (posted) value
    		$new_value = $_POST['acf']['field_63ca95e88557a']; // this is the key of the repeater
    
    		// check if the old value is the same as the new value
    		if($old_value != $new_value) {
    			// Do something if they are different
    		} else {
    			// Do something if they are the same
    		}
    
    	}
    
    	// don't forget to return to be saved in the database
    	return $value;
    
    }
    add_filter('acf/update_value', 'delegate_form_update', 10, 3);

    Can anyone help, or point me in the right direction? @hube2 @acf-support ?

    Thanks

    Mark

  • Solving

    acf_form – "On Update" action

    Hey all,

    So, I have a repeater field which my site users will be able to use on the frontend using acf_form() to add rows to the repeater. This just happens to be a WooCommerce order, but I don’t think that’s relevant

    Form works fine, rows get added etc and saved to the order. Cool.

    Now, one of the fields in the repeater is an email address. Here’s what I’m hoping I can get to happen:

    1. User adds rows to the repeater on the frontend and submits the acf_form()
    2. When the repeater is saved OR updated on the frontend, the email addresses in the email sub field get an email notification (I can format the email myself later), but only the updated rows/fields

    This action needs to be triggered EVERY TIME the form is changed and submitted on the frontend

    Hopefully this is possible

    Here’s kind of what I have from another support post I stumbled on from Google:

    function delegate_form_update($value, $post_id, $field) {
    
    	// only do it to certain custom fields
    	if($field['name'] == 'ticket_alloc') { // ticket_alloc is the name of the repeater
    
    		// get the old (saved) value
    		$old_value = get_field('ticket_alloc', $post_id);
    
    		// get the new (posted) value
    		$new_value = $_POST['acf']['field_63ca95e88557a']; // this is the key of the repeater
    
    		// check if the old value is the same as the new value
    		if($old_value != $new_value) {
    			// Do something if they are different
    		} else {
    			// Do something if they are the same
    		}
    
    	}
    
    	// don't forget to return to be saved in the database
    	return $value;
    
    }
    add_filter('acf/update_value', 'delegate_form_update', 10, 3);

    Can anyone help, or point me in the right direction? @hube2 @acf-support ?

    Thanks

    Mark

  • Solving

    ACF Learndash

    Hi guys, I hope I am writing in the correct section.

    I have a client’s site in wordpress + learndash + woocommerce (learndash integrated with woocommerce), in the course section of learndash there are some fields in ACF, my question is, how can I bring the value of an ACF field from the course section, in the checkout?

    That field that I need to bring in is a date field (name given by the client: “expire course”), it is the expiration of the course that needs to be present in the checkout as it will need to be present in the API (woocommerce API + active campaign) as I will be going to create reminder notifications with active campaign with this date.

    I hope I explained myself well, thanks in advance!

  • Helping

    ACF Color picker value in css

    Dear ACF Community,

    I need some help with the ACF Extended Color Palette field. I added a Color Palette field to my woocommerce products, so any product can have a unique border color on hover. Normally Elementor supports dynamic fields like this, but the new Loop Builder feature has some issues dynamic data or ACF Fields.

    I tried to add it with css based on the tutorial from this article, but if i add the php code to the CSS in Elementors Custom CSS field, i get an unknown property error message.
    https://www.advancedcustomfields.com/resources/color-picker/

    Is there maybe a workaround?

    Thank you in advance!

  • Solving

    ACF warning messages appear in frontend

    Hi all,

    Using WordPress (latest version) Custom Post Types (latest version), ACF Pro (latest version) and Elementor Pro (latest version)

    I am posting my problem here because I have come up against a brick wall trying to get support for the issue, both from ACF Pro and from Elementor Pro.

    My website uses Custom Post Types (latest version), ACF Pro (latest version) and Elementor Pro (latest version), and has been working perfectly for 3 years, until about 1-2 weeks ago. Then I started to get Warning messages on the web page that uses ACF Pro fields to display a CPT called “products” (NOT Woocommerce products because this is a “catalog” site, not an e-commerce site, and I am not using Woo anyway). Plus, I have NO WARNINGS ACTIVATED inside any plugin on the site, nor in the wp_config.php file (DEBUG = FALSE) so the first thing I’d like to know is why I am seeing Warnings at all! Fatal errors – fine, I expect to see those if something bad goes wrong, but why is my site being defaced by mere Warnings?

    I would like to post a screenshot of these warnings, but no way to do so on this forum.

    Basically, I get a message like this, but repeated 14 times in a row at the top of the web page:
    Warning: Undefined array key 0 in /home/clients/[cient-number]/web/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-image.php on line 40

    The only variation to this message is as follows, where acf-url.php replaces acf-image.php.

    Warning: Undefined array key 0 in /home/clients/[cient-number]/web/wp-content/plugins/elementor-pro/modules/dynamic-tags/acf/tags/acf-url.php on line 34

    I do not have any caching plugin, and clear my brower cache all the time when working on the site, compulsively.

    ACF Pro says the problem comes from Elementor, and Elemntor’s reply to me shows they clearly have no clue what is causing it.

    At this stage I would be very happy to just comment out the code causing the problems, but have no idea how “essential” it is to ACF functionality. I have quite a lot of php dev experience, but zero experience of the WP framework and how the core & plugins fit together.

    Can someone somewhere give me ANY pointers here?

    Many thanks
    SH

  • Helping

    Getting the attributes of a product from an ACF relationship field

    Hello everyone,
    for quite some time I have been looking for solutions for this feature of mine, if anyone can help me I would be really happy.

    With a relationship field, article object, I created a select of 3 products from my e-commerce on woocommerce. With this code I was able to get the image, I would also need to get the attributes of the various products and link to each product the attributes and the buy button. Does anyone know how to do this?

    <?php

    $posts = get_field(‘product_id’);
    if( $posts ): ?>

    <?php endif; ?>
    </div>

Viewing 25 results - 76 through 100 (of 894 total)