Support » Plugins and Hacks » [Resolved] How to add a product via frontend in woocommerce?

[Resolved] How to add a product via frontend in woocommerce?

  • Am working on a project, my client want to allow users (customers) to create a product after loging.

    We are using woocommerce plugin.Is there any hook or shortcode available to add a product via frontend in woocommerce.

    Or any other ideas. Please reply



Viewing 15 replies - 1 through 15 (of 40 total)
  • Interested in the same. Any ideas on this?

    Hi GideonKimani

    Am searching this in very long and lost my time to find a correct answer.There is no plugins and extensions. But Finally i am decide that am going to use wp-user-frontend plugin to upload the product from front end.

    But need to customize this plugin as your wish to upload product.
    Any help reply me.


    Hey selvendran p,

    I’m using the plugin you mentioned and it works for adding simple products provided you just want to add a title, description and images. I can’t get it to post to a category yet but I’ve only been working with the free plugin for a few hours.

    It works great so far!

    Hi renegadesk

    You need to customize that free plugin. The plugin displays the default post category. So that you want to change the code to list you product category.

    Yeah that’s true. I’m almost committed to purchasing the premium version as it looks great. Just working out if I should go for it or get WP Types Toolkit instead.

    Have you had any progress with adding products via front end?

    oh ok ok nice. I have completed the progress with adding products Via front end.

    That’s great selvendran p!

    Care to explain to others how you did it? Would be excellent to have a working solution available for others that are looking.

    Yes renegadesk,

    Am ready to explain that. Am waiting for some one asking to me. because now am busy with another work..

    ok cool, well I’m asking 🙂

    When you get a chance it would be great if you could let us know how you did it.

    ok well renegadesk,

    The first thing is the plugin have the short code to display add post and edit post and list post pages. you should follow that to display you pages to add product and edit products.

    And also the plugin support the custom post type.

    so for example you goto create a page, name like “Add product” and put the short code in that page as
    [wpuf_addpost post_type=”product”]

    Now you go to add post via front end and go to check in admin. your added content displays under the woocommerce products.

    Thanks selvendran p. I have got that far. You mentioned earlier about post category not using product categories? Do you have a fix for that so you can pick product categories from the front end?

    Yes renegadesk

    That is correct. If you want to display product categories you need to edit this file wpuf-add-post.php in plugin at the line

    wp_dropdown_categories( 'show_option_none=' . __( '-- Select --', 'wpuf' ) . '&hierarchical=1&hide_empty=0&orderby=name&name=category[]&id=cat&show_count=0&title_li=&use_desc_for_title=1&class=cat requiredField&exclude=' . $exclude );

    Replace with

    wp_dropdown_categories( 'show_option_none=' . __( '-- Select --', 'wpuf' ) . '&hierarchical=1&hide_empty=0&orderby=name&name=category[]&id=cat&show_count=0&taxonomy=product_cat&echo=1&&title_li=&use_desc_for_title=1&class=cat requiredField&exclude=' . $exclude );

    Hi selvendran p,

    Thanks for your last message! That works perfect for showing the product categories on the ADD POST form.

    But if some product category is selected, it is not saved in the product when posting it.

    Could you please inform us what we should change in order to save the product category in the product?

    Thanks in advance for your help!

    Hi martinjesus,

    The plugin not store the product category correctly. Because the plugin made by only the post type categories. But woocommerce uses the product_cat as taxonomy. so we need to store our selected category.

    So need to add some code in the wpuf-add-post.php file at after

    if ( wpuf_get_option( 'allow_cats' ) == 'on' )
                $post_category = $_POST['category'];

    Add the code below

    $subCategory = get_term_by( 'slug', $cn, 'product_cat' );
    			$mainCategory = get_term_by( 'id', $subCategory->parent, 'product_cat',ARRAY_A );
    $parid = $mainCategory['parent'];
    $tid = $mainCategory['term_taxonomy_id'];
    $mid = $mainCategory['term_id'];

    Then use this $parid , $tid, $mid to set post term.

    hi ,selvendran p
    I have doubt in plugin customization .. can you help me..

Viewing 15 replies - 1 through 15 (of 40 total)
  • The topic ‘[Resolved] How to add a product via frontend in woocommerce?’ is closed to new replies.