Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › Show Vendor Products with Shortcode
Tagged: shortcode
- This topic has 9 replies, 2 voices, and was last updated 4 years, 6 months ago by Sushobhan.
- AuthorPosts
- April 26, 2020 at 10:40 pm #123398Haime CroezeParticipant
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
- April 27, 2020 at 10:54 am #123543SushobhanKeymaster
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! - April 27, 2020 at 9:05 pm #123782Haime CroezeParticipant
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. - April 27, 2020 at 9:42 pm #123798SushobhanKeymaster
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!
- April 27, 2020 at 11:02 pm #123832Haime CroezeParticipant
Great! I can see it now. I had the Welcome box disabled because I do not use the profile module
Thanks!
- April 28, 2020 at 7:13 pm #124281SushobhanKeymaster
Hi,
Do you want me to show it in some other place?
Let me know.
Thanks! - April 28, 2020 at 8:12 pm #124308Haime CroezeParticipant
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. - April 29, 2020 at 1:35 pm #124563SushobhanKeymaster
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!!! π
- April 30, 2020 at 4:04 am #124880Haime CroezeParticipant
Hi Sushobhan,
thank you! It works great!
regards,
Haime
- April 30, 2020 at 11:50 pm #125188SushobhanKeymaster
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.
- AuthorPosts
- You must be logged in to reply to this topic.