1. Home
  2. ReHub Theme
  3. Shop (woocommerce) options
  4. How to make classified site on Woocommerce

How to make classified site on Woocommerce

What is difference between classified shop and regular shop? Classified site doesn’t sell anything. Vendors (sellers) just add products and their contacts. When buyer wants to buy something, he contacts with vendor.

Now, I will show you some simple ways to do this.

First of all, you need to disable Primary buttons on your site. You can do this in  Theme option – Shop settings – Disable button inside Product page  . Also, you can disable buttons in product loops inside  Theme option – Loop customization – Disable button in ALL product loops? 

Then, you can have several ways how to add custom buttons with custom functions.

1 way – Private messages (Buddypress)

When user clicks on button, he goes to private messages and can send message to owner of product.

To do such logic, you need to enable Buddypress plugin and Message extension (in Settings – Buddypress).

Then, if you disabled primary buttons, you can add custom button to Product. Use next shortcode for this.

[wpsm_button link=buddypress class="single_add_to_cart_button"]Contact with author[/wpsm_button]

Place this shortcode in Theme option – shop settings – After Button Area or in other custom code areas of product 

You can also place the same shortcode for custom Floating panel area in the same place in theme options

You can also add the same button in archive loop (Theme option – shop settings – Code zone inside product loop). Use there next code

[wpsm_button link=buddypress class="woo_loop_btn"]Contact with author[/wpsm_button]

2 way – Contact form in Popup

Second way doesn’t require user registration and profiles and can work also for guests.

First of all, install and activate plugin Contact Form 7. Then, create new form. Now, in settings of form, you can add recepient of email which will be author of product (vendor). To do this, add shortcode

[_post_author_email]

to field, like this

As you see, I have two recipients in form. First is admin email, second is email of author. There are some other mail tags which you can use. Also, you can add any fields in your form.

Then, save form and copy shortcode of form. Use shortcode inside our Button popup shortcode. Example, for button for inner pages

[wpsm_button_popup class="single_add_to_cart_button" btn_text="Contact with author"][contact-form-7 id=8][/wpsm_button_popup]

Place this shortcode in Theme option – shop settings – After Button Area or in other custom code areas of product

You can use also shortcode for Product archives as in previous method, but we don’t recommend to do this as it will add multiple hidden contact forms on page.

You can configure email which will get vendor. For example, I think it’s good to add Product title from which user contacts with vendor. You can add in Message Body field of form next shortcode

-------------

User is interested in [_post_title]

You can check your product here [_post_url]

-------------

Other mailtags can be found here

It’s not required to use Contact form 7 plugin. You can use any other form plugin with our button popup shortcode.

If you want to replace Primary woocommerce button (this will add your custom button also to floating panel), you must do more advanced customization. This is example of code

add_filter('woocommerce_loop_add_to_cart_link', 'change_woo_button');
function change_woo_button(){
    return do_shortcode('[wpsm_button_popup class="single_add_to_cart_button" btn_text="Contact with author"][contact-form-7 id=8][/wpsm_button_popup]');
}

This is more advanced customization. Check how to customize theme

Add user phone and custom user meta to product

If you have any plugin on site where user can add own phone and you want to show this phone on site in product page, you can use next shortcode to retrieve any meta field from user’s profile.

For example, you have Buddypress on site. Good thing in Buddypress, that it can have custom User fields. To enable them, enable Xprofile addon in Settings – Buddypress. Then, go to  Users – Profile fields  . Add there field for Phone.

Now, user can add his phone in his Profile, but also, you can add this field to Registration form. To do this, go to  Theme option – shop settings – Add xprofile fields to register form?  .

So, user has now Phone field. You can show value of this field on Product page near button via shortcode

[rh_get_profile_data name="My phone" userid=author type=raw]

This code will check author of product and will show Xprofile field “My phone”.

Place this shortcode in Theme option – shop settings – After Button Area or in other custom code areas of product

If you use some custom membership plugin and this plugin saves values in User meta fields, you can get them via shortcode

[rh_get_profile_data usermeta="_phone" userid=author type=raw]

Do you wantto show phone as Button? Very easy to do

<div class="single_add_to_cart_button whitecolor">[rh_get_profile_data name="My phone" userid=author type=raw]</div>

Configuration for site, User submit, Registration

In this article we show how to change default Primary buttons of woocommerce. For all other configurations, please read our step by step tutorial for Directory and Classified sites on Woocommerce