Durga Puja

We're celebrating Durga Puja! Grab Upto 25% OFF on all WCFM Addons.

Claim Offer
04Day 06Hr 20Min 11Sec
Durga Puja

CHANGE STORE NAME TO LAST NAME AND FIRST NAME OF THE VENDOR

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Best Multi Vendor Marketplace Plugin for WordPress › Forums › WC Vendors › CHANGE STORE NAME TO LAST NAME AND FIRST NAME OF THE VENDOR

Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #125602
      karl.deligero
      Participant

      Hi,

      I want to change the store name to the Last Name and First Name of the vendor.

      It is possible?

      Thank you

    • #125646
      Sushobhan
      Keymaster

      Hi,
      Thanks for getting in touch with us!
      Yes, that’s absolutely possible. Please use the following snippet-

      add_action( 'wcfmmp_new_store_created', function( $vendor_id, $wcfmmp_settings ) {
          global $wpdb;
          $store_user = get_user_by( 'id', $vendor_id );
          $first_name = $store_user->first_name;
          $last_name = $store_user->last_name;
          if ( $first_name || $last_name ) {
              $store_name = trim( "{$first_name} {$last_name}" );
              $store_slug = sanitize_title( wc_clean( $store_name) );
              update_user_meta( $vendor_id, 'store_name', $store_name );
              update_user_meta( $vendor_id, 'wcfmmp_store_name', $store_name );
              $wcfmmp_settings['store_name'] = $store_name;
              update_user_meta( $vendor_id, 'wcfmmp_profile_settings', $wcfmmp_settings );
              $wpdb->query( "UPDATE {$wpdb->prefix}users SET user_nicename = '{$store_slug}' WHERE ID =  $vendor_id" );
          }
      }, 50, 2 );
      add_filter( 'wcfm_is_allow_store_name', '__return_false' );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/
      Let me know how this goes.
      Thanks!

    • #125671
      karl.deligero
      Participant

      Hi,

      Thank for the quick response. It Works 🙂

      Thank you

    • #125694
      Sushobhan
      Keymaster

      You are always welcome 🙂
      Let me know if there’s anything else we can help you with.
      Can we ask for a favor? Would you mind taking a few minutes to review our plugin (if you haven’t already) at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.

Viewing 3 reply threads
  • The topic ‘CHANGE STORE NAME TO LAST NAME AND FIRST NAME OF THE VENDOR’ is closed to new replies.