• Resolved teamf

    (@teamf)


    Hi I want to be able to default the stock quantity of a product added by a vendor on my site to 1, so that only 1 of each item can be sold. The user can override the default if needed of course.
    If that possible with WooCommerce Multivendor Marketplace? I am using a Theme that s integrated with WooCommerce

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

    (@wclovers)

    Hi,

    Please add this code to your child theme’s functons.php for the purpose –

    add_filter( 'wcfm_product_fields_stock', function( $stock_fields, $product_id, $product_type ) {
    	if( !$product_id ) {
    		if( isset( $stock_fields['manage_stock'] ) ) {
    			$stock_fields['manage_stock']['dfvalue'] = 'enable';
    		}
    		if( isset( $stock_fields['stock_qty'] ) ) {
    			$stock_fields['stock_qty']['value'] = 1;
    		}
    		if( isset( $stock_fields['sold_individually'] ) ) {
    			$stock_fields['sold_individually']['dfvalue'] = 'enable';
    		}
    	}
      return $stock_fields;
    }, 50, 3 );

    Thank You

    Thread Starter teamf

    (@teamf)

    Thanks very much

    Plugin Author WC Lovers

    (@wclovers)

    Welcome ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Ability to default stock quantity 1 when adding a product’ is closed to new replies.