How to enable Google Business (Google My Business) as a social media link on the Dokan vendor dashboard?How to enable Google Business (Google My Business) as a social media link on the Dokan vendor dashboard?

Hello guys how are you? Welcome back to my blog therichpost.com. Guys today in this post, I will tell show you How to enable Google Business (Google My Business) as a social media link on the Dokan vendor dashboard?

Guys if you are new in  WordPress or in  WooCommerce then please check the below links for some good tutorials:
  1. WooCommerce Hooks
  2. WordPress Tricks
  3. WordPress Hooks
  4. Dokan

Here is the working steps for To enable Google Business (Google My Business) as a social media link on the Dokan vendor dashboard, you’ll need to customize Dokan, as Google Business is not included by default in the vendor social media profile options.
and please follow carefully:


Here’s how you can add Google Business as a new social media field:


✅ Step 1: Add Field to Vendor Dashboard

Use the dokan_settings_form_bottom action hook to add the Google Business URL field.

add_action('dokan_settings_form_bottom', 'add_google_business_field_to_vendor_dashboard');

function add_google_business_field_to_vendor_dashboard($current_user) {
    $store_info = dokan_get_store_info($current_user->ID);
    $google_business = isset($store_info['social']['google_business']) ? esc_attr($store_info['social']['google_business']) : '';
    ?>
    <div class="dokan-form-group">
        <label class="dokan-w3 dokan-control-label" for="store_google_business">Google Business</label>
        <input type="url" name="settings[social][google_business]" id="store_google_business" class="dokan-form-control" value="<?php echo $google_business; ?>" placeholder="https://business.google.com/..." />
    </div>
    <?php
}

✅ Step 2: Save the Field

Use the dokan_store_profile_saved action hook to ensure it saves with the vendor profile.

add_action('dokan_store_profile_saved', 'save_google_business_field', 15, 2);

function save_google_business_field($store_id, $dokan_settings) {
    if (!empty($_POST['settings']['social']['google_business'])) {
        $social = $dokan_settings['social'];
        $social['google_business'] = esc_url_raw($_POST['settings']['social']['google_business']);
        $dokan_settings['social'] = $social;
        update_user_meta($store_id, 'dokan_profile_settings', $dokan_settings);
    }
}

✅ Step 3: Show Google Business Link on Store Page (Optional)

If you also want to display the Google Business link on the frontend store page:

add_action('dokan_store_profile_frame_after', 'show_google_business_link');

function show_google_business_link($store_user) {
    $store_info = dokan_get_store_info($store_user->ID);
    if (!empty($store_info['social']['google_business'])) {
        echo '<li><a href="' . esc_url($store_info['social']['google_business']) . '" target="_blank"><i class="fa fa-map-marker"></i> Google Business</a></li>';
    }
}

✅ Optional: Add an Icon (CSS or FontAwesome)

To make the link look like other social links, ensure you’re using proper FontAwesome classes or custom icons.


✅ Final Notes:

  • This requires basic PHP and WordPress theme/plugin editing.
  • Always test in a staging environment before deploying to live.
  • You may want to move this to a custom plugin or your theme’s functions.php.

Would you like this in a plugin format to install directly instead?

Ajay

Thanks

By therichpost

Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.