1. Home
  2. WC Vendors Marketplace
  3. How To
  4. Custom Fields to Vendor Settings Page

Custom Fields to Vendor Settings Page

Many members ask us how to add a custom field to their Vendor Dashboard > Shop Settings page. Simply add this code to your themes functions.php file after customizing it to ask for the data you like.

add_action('wcvendors_settings_after_paypal', 'pv_add_custom_merchant_id_field');
function pv_add_custom_merchant_id_field() {
    <div class="pv_merchant_id_container">
      <p><b><?php _e( 'Merchant ID', 'wc_product_vendor' ); ?></b><br/>
        <?php _e( 'Your Checkout.fi merchant ID.', 'wc_product_vendor' ); ?><br/>

        <input type="text" name="pv_merchant_id" id="pv_merchant_id" placeholder="1234" value="<?php echo get_user_meta( get_current_user_id(), 'pv_merchant_id', true ); ?>" />

add_action( 'wcvendors_admin_after_commission_due', 'pv_admin_user_info' );
function pv_admin_user_info( $user ) {
    <th><label for="pv_merchant_id"><?php _e( 'Merchant ID', 'wc_product_vendor' ); ?></label></th>
    <td><input type="text" name="pv_merchant_id" id="pv_merchant_id" value="<?php echo get_user_meta( $user->ID, 'pv_merchant_id', true ); ?>" class="regular-text"></td>

add_action( 'wcvendors_shop_settings_saved', 'pv_save_merchant_id' );
add_action( 'wcvendors_update_admin_user', 'pv_save_merchant_id' );
function pv_save_merchant_id( $user_id )
  if ( isset( $_POST['pv_merchant_id'] ) ) {
    update_user_meta( $user_id, 'pv_merchant_id', $_POST['pv_merchant_id'] );



Updated on November 14, 2016

Was this article helpful?