Support

Account

Forum Replies Created

  • Thank you. I’m a little overworked but I’ll see quickly if this information helps me. Anyway thank you I did not know this information.

  • Ok, thank you both ^^

  • Thanks !
    I think the same with the assets of CPT : status (draft,…), date,…
    But I was afraid of the connection between CPTs.
    I’ll try your plugin. Is it still maintained ?

  • Thanks a lot 🙂
    I want every service and every skill to have its own page to make a lot of textual content for SEO, so I was thinking of using CPT for everything but Format, with links between CPTs to sort them (ACF Post-2-Post plugin probably) … but someone told me that I could use Taxonomies for : Formats, Services, Skills with some meta on it to obtain the same result : description pages with lot of content.

    Skills will provide information about each area of expertise.

  • Arghhh, I am really tired to ask such a silly question o_O
    Thanks

  • Ok. I did it the easiest way, by adding customs fields to checkout.
    ^^
    Good explanations there :
    http://www.portmanteaudesigns.com/blog/2015/02/04/woocommerce-custom-checkout-fields-email-backend/

  • Hi James,

    I’m trying to understand your advices since 1 hour but I’m a bit lost.

    Example : The customer can buy a bike for him and another for his little girl. So he must give 2 different weight. So I must have a form on my product page but the data must be recorded as new item cart.
    So what I need is just a field Weight and not a repeater one ?

    Another thing that I don’t understand : I’ve tried (for the first time) acf_form on single product page. It’s funny, I didn’t know that we could make all the data recordable in front. But I can not record the weight on products data cause another client can be on the same product buying it and giving another weight. And I don’t know a way to block the record during this time.

  • To have numbers instead of text :

    'type'              => 'number', 
            'custom_attributes' => array(
                'step' 	=> 'any',
                'min'	=> '0'
            ), 

    Now, gonna put all of this to trash cause what I really need is to have my custom field on each bought product : if I want to buy a bike for an adult and a bike for a child, I will have to give two different weights… o_O

  • Well, with you advices, it seems to work.

    If someone is interested :

    /**
     * Add custom fields to user / checkout
     */
    add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' );
    
    function my_custom_checkout_field( $checkout ) {
    
        echo '<div id="bv_custom_checkout_field"><h2>Measurements</h2>';
    
        /* Weight */
        woocommerce_form_field( 'weight_customer', array(
            'type'          => 'text',
            'class'         => array('my-class form-row-wide'),
            'label'         => __('Your weight'),
            'placeholder'   => __('Your weight'),
        ), get_user_meta(  get_current_user_id(),'weight_customer' , true  ) );
    
        echo '</div>';
    }
    
    /**
     * Verification 
     */
    add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');
    
    function my_custom_checkout_field_process() {
        // Check 
        if ( ! $_POST['weight_customer'] )
            wc_add_notice( __( 'Do not forget weight.' ), 'error' );
    }
    
     * Update field
     */
    add_action( 'woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' );
    
    function my_custom_checkout_field_update_order_meta( $order_id ) {
        if ( ! empty( $_POST['weight_customer'] ) ) {
            update_user_meta( get_current_user_id(), 'weight_customer', sanitize_text_field( $_POST['weight_customer'], '' ));
        }
    }

    I just don’t know how to tell him that it is a number (the weight) but it works.

  • Sorry, my english is too bad : I wanted to say “thanks because u have helped me” and not “please help me” lol
    I’ll code it. I’ll just take a lot of time to do it, but I will get there 🙂
    I’m going to follow your advices.

  • Ok… this part wanna be hard for me (code)

    Thanks for helping me ^^

  • Thanks. It looks like it is simpler to do all the thing with woocommerce functions ?
    I found this yesterday :
    https://support.woothemes.com/hc/en-us/articles/203182373-How-to-add-custom-fields-in-user-registration-on-the-My-Account-page
    and I wonder if it is not easier for me to add custom fields like this than with acf (only for registration custom fields).
    Because what you say to me is that I need to “marry” acf code & woocommerce code, isn’t it ?

  • Yes. I was waiting because sometimes a problem come back again but it seems to be resolved…
    I know about github, I need to find time to study all of this (github) cause I still work the old way 🙂

  • Hi,
    I can’t reproduce the problem now, so I think maybe it’s a side effect…

    My code is quite simple :

    if( function_exists('acf_add_local_field_group') ):
    
        // Woocommerce : Product page fields
    
        acf_add_local_field_group(array (
            'key' => 'group_575eadb687a13',
            'title' => 'PRODUCT INFORMATIONS',
            'fields' => array (
                array (
                    'key' => 'field_575eadcca9ddd',
                    'label' => '3 Instagram Photos',
                    'name' => 'three_instagram_photos',
                    'type' => 'gallery',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array (
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'min' => '',
                    'max' => 3,
                    'preview_size' => 'medium',
                    'insert' => 'append',
                    'library' => 'all',
                    'min_width' => '',
                    'min_height' => '',
                    'min_size' => '',
                    'max_width' => '',
                    'max_height' => '',
                    'max_size' => '',
                    'mime_types' => '',
                ),
                array (
                    'key' => 'field_57682747afc89',
                    'label' => 'External video',
                    'name' => 'external_video',
                    'type' => 'oembed',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array (
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'width' => '',
                    'height' => '',
                ),
                array (
                    'key' => 'field_57714db3280c7',
                    'label' => 'More description',
                    'name' => 'more_description',
                    'type' => 'wysiwyg',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array (
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'default_value' => '',
                    'tabs' => 'all',
                    'toolbar' => 'full',
                    'media_upload' => 1,
                ),
            ),
            'location' => array (
                array (
                    array (
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'product',
                    ),
                ),
            ),
            'menu_order' => 0,
            'position' => 'acf_after_title',
            'style' => 'default',
            'label_placement' => 'top',
            'instruction_placement' => 'label',
            'hide_on_screen' => '',
            'active' => 1,
            'description' => '',
        ));
    	...
  • Thanks. I did it work 🙂

  • A last question before returning back :
    With my method, which is wrong bug, I can assign a brand, a color, a year to my products. I can see them on archive pages. I can see them in admin array (I’ve added column for attributes), I can even see them on custom template archives pages like taxonomy-pa_brand.php.

    So if I override additional-information.php to get my fields instead of attributes list, I got everything I need ?

  • Ok. And thank you both for answering.
    As I am at 80% of the project, and as I am as good developper as english spoker 😉 I gonna try not to go further but to return to a conventional use of woocommerce attribute. Their interface for attributes is a nonsense, but never mind.

  • Didn’t know acf hook… I’m doing it on plugins_loaded
    And because I use Polylang, I get back Ids of translated pages in an array, then begin my declaration like this :

        $contact_args = array (
            'key' => 'group_573366ed5685a',
    

    and end it like that :

       foreach($idLangs[1718] as $idLang){
            $contact_args['location'][] = array (
                array (
                    'param' => 'page',
                    'operator' => '==',
                    'value' => $idLang,
                ),
            );
        }
        acf_add_local_field_group($contact_args);
    

    I don’t like it because I don’t like to have to set an id page directly in code but I didn’t find anything else to make it work with polylang.

  • Ok. I think I’ve understood everything especially that I need to change my way of using ACF in future projects. There are many tutos about how to do something or another with acf but there is not a lot of about how to use it properly.

    Thanks a lot 🙂

  • Just last one : It would be a lot of work for me for this project because, first of all, it’s the end of the development, and most of all, because I use polylang for languages and I loop on every language by declaring my fields exported in PHP in functions. If I remove php fields declarations from my mu-plugin and install ACF PRO as a normal plugin, I don’t know how I will loop on languages to declare them.

  • Ok. Thanks for the answer.
    I’m not sure about what I’m gonna do with this client : I will be the one maintaining the website so I thought at first that I could manually update files each time there’s an update. But what you say makes me think…

  • Sorry for my bad explanations :
    It’s a unique website made for a unique client. I included ACF as files and activate it with a must use plugin because I don’t want that my client see that I use ACF plugin.
    So, how can I make it updatable, but not by the client ?

  • Sorry : I found solution with another post here but couldn’t come to say that yesterday : I had updated ACF Pro on my local website which I use to create my custom fields but not the one inline which get the custom fields : so there was 2 different versions of ACF Pro and that was the problem.

    So it is resolved.

    Thanks

Viewing 24 posts - 1 through 24 (of 24 total)