Show Vendor Products with Shortcode

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!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM Show Vendor Products with Shortcode

Tagged: 

Viewing 9 reply threads
  • Author
    Posts
    • #123398
      Haime Croeze
      Participant

      Hi,

      I am using the [products store=""] shortcode and it works beautifully. My only issue is that I want the store ID to be provided by the vendor (is a block to show the products in his/her listing). How can the vendor know the ID? I can see it as admin but the vendor cannot see it in store manager).

      regards

    • #123543
      Sushobhan
      Keymaster

      Hello,
      Where you want to let your vendors put this shortcode? And how they are doing it? If possible few snapshots to make things clearer.
      Then we’ll be able to do that dynamically. Means the vendor doesn’t need to know their ID.

      Alternatively, we can add the ID information anywhere in the dashboard. Say just beside vendors name like this –
      Here is the code snippet for that-

      add_action( 'wcfm_dashboard_after_username', function($id) {
          if ( wcfm_is_vendor() ) echo "<span class='store_id'>ID: #{$id}</span>";
      } );

      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!

    • #123782
      Haime Croeze
      Participant

      Hi Sushobhan,

      thanks for this snippet! I tested it but I cannot see where it should pop-up.

      What I am trying to achieve is to show the vendors products “automatically” in the vendor’s MyListing listing. To achieve that I have set up a field in MyListing where the vendor can enter his store-id (see screenshots). That makes a custom block in MyListing that has the standard WooCommerce products shortcode work [products store=”[[store-id]]” ] and shows the vendors products in the listing (see screenshots)

      If I can get the store-id to show (as a label) Vendor Dashboard – Settings – Store – General Settings (just above the Store Name field) would be great. (see screenshot) Greatest would be (afraid that would be lots of coding) would be if the vendor doesn’t need to enter the store-id in the listing but can check (checkbox) it ( I can add custom checkbox field for that).

      kind regards

      Attachments:
      You must be logged in to view attached files.
    • #123798
      Sushobhan
      Keymaster

      The snippet I provided you, add the ID information on the Dashboard welcome box, just beside vendor’s name. Check here- https://imgur.com/jUDnehc
      Will this suffice your requirement? Let me know.

      Thanks!

    • #123832
      Haime Croeze
      Participant

      Great! I can see it now. I had the Welcome box disabled because I do not use the profile module

      Thanks!

    • #124281
      Sushobhan
      Keymaster

      Hi,
      Do you want me to show it in some other place?
      Let me know.
      Thanks!

    • #124308
      Haime Croeze
      Participant

      Hi Sushobhan,

      If I can get the store-id to show (as a label) on Vendor Dashboard – Settings – Store – General Settings (just above the Store Name field) would be great. (see screenshot)

      regards,

      Haime

      Attachments:
      You must be logged in to view attached files.
    • #124563
      Sushobhan
      Keymaster

      Hello,
      For that use the following snippet-

      add_filter('wcfm_marketplace_settings_fields_general', function($general_fields, $user_id) {
          if ( wcfm_is_vendor() && isset($general_fields['store_name']) ) {
              return array_merge( array(
                  'vendor_id_txt' => array('label' => __('Your\'s ID', 'wc-frontend-manager'), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'attributes' => array( 'readonly' => true ), 'value' => $user_id ),
                  'vendor_id_html' => array('label' => __('Your\'s ID', 'wc-frontend-manager'), 'type' => 'html', 'class' => 'vendor-id-wrapper', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $user_id ),
              ), $general_fields ); 
          }
          return $general_fields;
      }, 10, 2 );

      Here I have shown the vendor id in two ways- as a readonly textbox ‘vendor_id_txt’ and as html div ‘vendor_id_html’. Kindly delete one of them. If you choose to keep ‘vendor_id_html’ then you might need to add some custom css to look it more appealing. For that I have already added a class ‘vendor-id-wrapper’ for you.

      All the best!!! πŸ™‚

    • #124880
      Haime Croeze
      Participant

      Hi Sushobhan,

      thank you! It works great!

      regards,

      Haime

    • #125188
      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 9 reply threads
  • You must be logged in to reply to this topic.