• Resolved misstest

    (@misstest)


    is it posible to register a vendor and have already a product posted?

    For example= i register a vendor. when the vendor logs in, it has already published a product.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WC Lovers

    (@wclovers)

    Hi,

    Yeah possible.

    But what will be content for that product? Title, description, price etc …

    Thank You

    Thread Starter misstest

    (@misstest)

    It would be like this:
    Title: Makeup
    Description: Product used to decorate or fix a person’s facial or body features; This consists of various elements with specific functions for each part.
    Price: 10
    Short description: Coming soon

    • This reply was modified 6 years, 4 months ago by misstest.
    Plugin Author WC Lovers

    (@wclovers)

    HI,

    Please add this code to your site for the purpose-

    add_action( 'wcfmmp_new_store_created', function( $member_id, $wcfmmp_settings ) {
    	$product_args = array(
    												'post_title'   => 'Makeup',
    												'post_status'  => 'publish',
    												'post_type'    => 'product',
    												'post_excerpt' => 'Coming soon!',
    												'post_content' => 'Product used to decorate or fix a person’s facial or body features; This consists of various elements with specific functions for each part.',
    												'post_author'  => $member_id,
    												'post_name'    => sanitize_title('Makeup')
    											);
    	$new_product_id = wp_insert_post( $product_args, true );
    	update_post_meta( $new_product_id, '_wcfm_product_author', $member_id );
    	
    	// Set Product Type
    	wp_set_object_terms( $new_product_id, 'simple', 'product_type' );
    	
    	// Set Price
    	update_post_meta( $new_product_id, '_regular_price', '10' );
    	update_post_meta( $new_product_id, '_price', '10' );
    }, 50, 2 );

    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/

    Thank You

    Thread Starter misstest

    (@misstest)

    Thank you so much!!!

    There is a way to also add the image?

    P.S: you guys deserve a 10 star!

    Plugin Author WC Lovers

    (@wclovers)

    Sure, hope you want to associate “Featured Image” for this product?

    You have to know me that image’s attachment id.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Register a vendor’ is closed to new replies.