Product Sold Individually and only virtual

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!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Product HUB Product Sold Individually and only virtual

Viewing 1 reply thread
  • Author
    Posts
    • #87422
      lorisgm21
      Participant

      Hello,
      I want every product that a seller adds is sold individually. In addition, every product must be a Simple Product and virtual…
      Because my sellers are only allowed to sell virtual products!
      Is that possible?

      Maybe you can help me 😉

    • #87520
      WCFM Forum
      Member

      HI,

      Please add this code to your site –

      add_filter( 'wcfm_product_manage_fields_general', function( $general_fields, $product_id, $product_type ) {
      	if( isset( $general_fields['is_virtual'] ) ) {
      		$general_fields['is_virtual']['dfvalue'] = 'enable';
                      $general_fields = wcfm_hide_field( 'is_virtual', $general_fields );
      	}
      	return $general_fields;
      }, 50, 3 );
      add_filter( 'wcfm_product_fields_stock', function( $stock_fields, $product_id, $product_type ) {
      		if( isset( $stock_fields['manage_stock'] ) ) {
      			$stock_fields['manage_stock']['dfvalue'] = 'enable';
      		}
      		if( isset( $stock_fields['sold_individually'] ) ) {
      			$stock_fields['sold_individually']['dfvalue'] = 'enable';
      		}
      	$stock_fields = wcfm_hide_field( 'manage_stock', $stock_fields );
      	$stock_fields = wcfm_hide_field( 'stock_status', $stock_fields );
      	$stock_fields = wcfm_hide_field( 'sold_individually', $stock_fields );
        return $stock_fields;
      }, 50, 3 );

      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/

      Disable other product types except simple from capability setting – https://ibb.co/56p6CJD

      Thank you

Viewing 1 reply thread
  • The topic ‘Product Sold Individually and only virtual’ is closed to new replies.