June 29, 2023 at 6:52 PM
#193910
Keymaster
Hi,
If you want add Advance Custom Fields in your storefront page then you need good amount of custom code to integrede the ACF plugin functionality.
Another way is add below code to your function.php of the current active theme to get the field.
add_action( 'mvx_after_shop_front', 'add_mvx_custom_fields');
function add_mvx_custom_fields() {
$vendor_id = get_current_vendor_id();
$custom_value = get_user_meta( $vendor_id, '_mvx_custom_field_name', true ) ?get_user_meta( $vendor_id, '_mvx_custom_field_name', true ) : '';
?>
<div class="panel panel-default pannel-outer-heading">
<div class="panel-heading">
<h3><?php _e('Custom Settings', 'multivendorx'); ?></h3>
</div>
<div class="panel-body panel-content-padding form-horizontal">
<div class="mvx_media_block">
<div class="form-group">
<label class="control-label col-sm-3 col-md-3"><?php _e('custom field', 'multivendorx'); ?></label>
<div class="col-md-6 col-sm-9">
<input class="form-control" type="text" placeholder="custom field" name="_mvx_custom_field_name" value="<?php echo $custom_value; ?>">
</div>
</div>
</div>
</div>
</div>
<?php
}
add_action('mvx_before_vendor_dashboard', 'save_custom_fields');
function save_custom_fields(){
global $MVX;
$vendor_id = get_current_vendor_id();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $MVX->endpoints->get_current_endpoint() == 'storefront') {
if ($_POST['_mvx_custom_field_name']) {
update_user_meta( $vendor_id, '_mvx_custom_field_name', wc_clean($_POST['_mvx_custom_field_name']) );
}
}
}
Regards,






