Comments 8Drews started the conversationJanuary 21, 2023 at 3:17pmHow would you add a ACF to be displayed when a vendor is editing a product? add_action( 'marketking_edit_product_after_tags', 'view_acf_field_for_single_product', 10 );function view_acf_field_for_single_product(){ if (function_exists('the_field')){ the_field('attest'); } }Trying to get something like this to work. 2,214WebWizards repliedJanuary 21, 2023 at 11:41pmHi Drew,Are you looking to add a field that can be edited by each vendor for their own products?Here is an example:1) I created a text field in ACF named 'productcolor':2) I added this PHP code snippet to the site: add_action('marketking_extend_page', function($pageid){ ?> <div id="marketking_footer_hidden"> <?php wp_footer(); ?> </div> <?php }); add_filter('marketking_css_queue', function($q){ $new_items = array('acf-global','acf-input','acf-pro-input','acf-datepicker','acf-timepicker','tinymce','tinymce-root'); $q = array_merge($q, $new_items); return $q; }, 10, 1); add_filter('marketking_js_queue', function($q){ $new_items = array('acf-global','acf-input','acf-pro-input','acf-datepicker','acf-timepicker','acf-color-picker-alpha','tinymce','tinymce-root'); $q = array_merge($q, $new_items); return $q; }, 10, 1); add_action('marketking_after_save_product', function($product_id, $vendor_id){ do_action( 'acf/save_post', $product_id ); }, 10, 2); add_action( 'marketking_edit_product_after_tags', function($post){ acf_form_head(); ?> <div class="col-xxl-12 col-md-12 marketking_card_gal_cat_tags" style="background: white; padding:20px;border-radius: 4px;"> <?php $product_id = $post->ID; acf_form(array( 'fields' => array('productcolor'), 'form' => false, 'post_id' => $product_id, )); ?> </div> <?php }); Most of the snippet is just enqueuing the necessary ACF scripts. At the very end you can see we name the 'productcolor' field.3) The field is now available and editable by each vendor:Kind regards,Stefan1 Like 8Drews repliedJanuary 22, 2023 at 1:35amYes, that works. Thanks!1 Like Sign in to reply ...
How would you add a ACF to be displayed when a vendor is editing a product?
add_action( 'marketking_edit_product_after_tags', 'view_acf_field_for_single_product', 10 );
function view_acf_field_for_single_product(){
if (function_exists('the_field')){
the_field('attest');
}
}
Trying to get something like this to work.
Hi Drew,
Are you looking to add a field that can be edited by each vendor for their own products?
Here is an example:
1) I created a text field in ACF named 'productcolor':
2) I added this PHP code snippet to the site:
Most of the snippet is just enqueuing the necessary ACF scripts. At the very end you can see we name the 'productcolor' field.
3) The field is now available and editable by each vendor:
Kind regards,
Stefan
Yes, that works. Thanks!