Add products to WooCommerce using WPUF
WPUF is a form builder plugin with custom post types. So, with its custom taxonomy and meta keying feature, it is also possible to use it as a frontend interface to post and manage products on your WooCommerce powered site.
We have created a small video tutorial of the entire process in this video, all the steps have also been described in detail below.
- WordPress (assuming you already have it installed)
- WP User Frontend Plugin (Installed and activated)
- WooCommerce Plugin (Installed and activated)
- Post Meta Inspector (optional)
After WPUF and WC is being installed and activated, WPUF will automatically capture the taxonomy, metas and post types from WC. Now you can start to create forms to upload product if you do not want to use the default backend posting of WC.
The Required Pages
We will be needing three pages to get started with.
- One Dashboard Page
The Dashboard page will display all the products submitted by the user.
- One Editing page
This page will allow that user to edit or update the uploaded product if the admin allows the user to.
- One Upload page
The main page from where the user will create the product.
The functions described will all be created by using forms and the forms will be added to the pages by using shortcodes.
Creating the Edit and Dashboard pages
Go to Dashboard > Pages > Add new page
Create two new pages named Dashboard and Edit and simply paste the shortcodes in them. For Dashboard page use
[wpuf_dashboard post_type="product"] and use
[wpuf_edit] in the Edit page.
Now go to WPUF > Settings > General Settings and to enable editing of products, select the page where [wpuf_edit] is located from the drop down menu.
Creating the Form
Now we are going to create the form to upload products, currently with these fields only. But you can add more fields as you wish.
WPUF > Forms > Add form
Now we need to add fields from the right panel. For creating a simple product we will need only 4 fields which are “post title” “post body” “featured image” and a “text” field to add price.
Fields which have “This taxonomy is a WooCommerce attribute” must be checked to be positive to work.
Post title – It will be your product tittle
Post Body – it will be your Products Description
Featured Image – will be your product’s Main Image
For the text field, please use
_price as the meta key for it to work as the price data for WooCommerce.
Product_type – The type of product it is. If you want to allow user to post just a simple product I will recommend you not to use this field.
Product_cat – You can allow users to choose all categories or specify only one or more.
You can also add custom taxonomies for WooCommerce such as
product_shipping_class if you want to add product type (simple, variation, downloadable etc), category, tag, shipping class if you want the user to set those fields out while uploading.
When you are satisfied adding fields to the form hit save and copy the shortcode for the form.
Create the Upload Page
Go to Pages > Add new page and create a page named “Upload Page” or what ever you prefer. Now paste the shortcode you just copied of the form you just created. Save or publish the page and view it.
As you are done creating the form and the required pages, you can now test if it is working. Load the page and upload a demo product with product name, description and image or any other mandatory fields.
After submission, please go to wp-admin > products and check if the product is created and all the information is updated.
If yes, good! Now you can additionally test if it can be edited by opening the same product from the Dashboard page you created by clicking Edit button and adding or changing details of the product and then going to the backend again to check the details.
You can add conditional logic for enabling or disabling menu items if the user is not logged in to your side for this product submission frontend. This will require some coding with your theme and developing skills.