Auto create default product when vendor will register.

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 5 reply threads
  • Author
    Posts
    • #81064
      Jose Solsona
      Participant

      Hi!
      Exist the posibility to auto create a default product when vendor register on the site?

      Someway with third party plugin or same like…

      Is it possible?

    • #81669
      WCFM Forum
      Keymaster

      Hi,

      Well, this is off course possible to add a default product for vendors just after registration.

      But, what will be configuration for that product?

      Thank You

    • #81938
      Jose Solsona
      Participant

      I need a product with the next caracteristics:

      Name: Pagar con tarjeta
      Price: 1€
      Description: No description
      No shipping (because desactivated)
      No attributes (because desactivated)

      That’s all.

    • #82436
      WCFM Forum
      Keymaster

      Hi,

      Please add this code to your site –

      add_action( 'wcfmmp_new_store_created', function( $member_id, $wcfmmp_settings ) {
      	$product_args = array(
      												'post_title'   => 'Pagar con tarjeta',
      												'post_status'  => 'publish',
      												'post_type'    => 'product',
      												'post_author'  => $member_id,
      												'post_name'    => sanitize_title('Pagar con tarjeta')
      											);
      	$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', '1' );
      	update_post_meta( $new_product_id, '_price', '1' );
      }, 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

    • #82549
      Jose Solsona
      Participant

      thanks you, it worked!

    • #82832
      WCFM Forum
      Keymaster

      Great … you are welcome 🙂

Viewing 5 reply threads
  • The topic ‘Auto create default product when vendor will register.’ is closed to new replies.