• In order to make creating adverts as quick as possible can we automatically pull the address from users woocommerce profiles?

    This could automatically populate the address fields of the advert creation form. It would still be editable by the advertiser but should save time.

    Alternatively it would be great if you could simply duplicate an advertisement then edit the copy before publishing.

Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    you can prefill the data in [adverts_add] form using the adverts_form_bind filter like this

    
    add_filter( "adverts_form_bind", function( $form ) {
      if( $form->get_scheme( "name" ) != "advert" ) {
        return $form;
      }
      if( get_current_user_id() < 1 ) {
        return $form;
      }
      $uid = get_current_user_id();
    
      $form->set_value( "adverts_email", wp_get_current_user()->user_email );
      $form->set_value( "adverts_phone", get_user_meta( $uid, 'phone_number', true ) );
    
      return $form;
    } );
    

    This will fill the email and phone fields if you want to fill some other fields as well you would need to add there a code that will do it.

Viewing 1 replies (of 1 total)

The topic ‘dynamically populate address on adverts’ is closed to new replies.