Enable manage stock and product qty 1
-
Hi,
For all products I am trying to enable manage stock and set Stock Qty to ‘1’ as per following screenshot.
https://snipboard.io/bZ40Kz.jpg
I have tried following code but it is not working
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 );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Enable manage stock and product qty 1’ is closed to new replies.