Hi! I sent in a Pre-Sale questions before purchasing your membership about adding a “View Store” button to directory listings. I received a response — Whenever you join, just ask in the forum for help with that code and we’ll send a developer your way to assist you…so here I am 🙂
I am using BuddyPress and WC Vendors with GeoDirectory.
I would like to add some code to have a “Shop My Store” button listed on all directory listings if listing owners are also Vendors with the WC Vendors plugin.
I am not that familiar with how to code. I found the following snippet from WC Vendors that adds a “Visit Store” button to the Buddypress profiles if the user is also a Vendor. Is there a simple modification to this code that could be performed to also have a \”Visit Store\” button on any listings that a user creates if that user is also a Vendor?
/* WC Vendors Pro Only – Adds View Store button to BuddyPress profiles */
add_action(\’bp_member_header_actions\’, \’wcvendors_pro_bp_member_header_actions\’);
function wcvendors_pro_bp_member_header_actions(){
$wcv_profile_id = bp_displayed_user_id();
$wcv_profile_info = get_userdata( bp_displayed_user_id() );
$wcv_profile_role = implode( $wcv_profile_info->roles );
$store_url = WCVendors_Pro_Vendor_Controller::get_vendor_store_url( $wcv_profile_id );
$sold_by = \'<div class=\”generic-button\” id=\”post-mention\”>Visit Store</div>\’;
if ( $wcv_profile_info->roles[0] == \”vendor\” ) {
$vendor_name_message = get_the_author_meta( \’user_login\’ );
$current_user = wp_get_current_user();
echo $sold_by;
}
}
—
The respondent to my Pre-Sale questions said I could even add a new tab on each listing created by a vendor and show their products within the listing.
That would be so amazing! Any help you could offer would be extremely appreciated!!