Default 1 in stock?

This topic contains 4 reply and 4 voices, and was last updated by Sk 10 years ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
April 12, 2014 at 6:11 pm 18600
Sk Is there a way to have the default stock show 1? Everyone is at least selling 1 item and I am not sure the stock management would cause any issues. If someone is listing a product, then of course they have at least one to sell. It seems having having 1 listed as default would be safe. just a thought.
April 12, 2014 at 7:02 pm 18602
Nizam Uddin Nizam Uddin

Hello Jay
Maybe this article can help you http://www.skyverge.com/blog/set-default-stock-quantity-woocommerce-variations/
Thank you

April 12, 2014 at 7:05 pm 18603
Rachelle Rachelle

I downloaded the plugin WooCommerce Sold Individually and it set all my items in my store as individually sold items. Since that wasn’t an option in my csv importer I would have had to manually change every listing. I’m not sure if that is what you are looking for but it worked great for me! 🙂

April 12, 2014 at 8:04 pm 18604
Jay Jay

I added the code below and it did not add 1 in the stock quantity. I added it to the dokan theme-functions.php.

add_action( ‘admin_enqueue_scripts’, ‘wc_default_variation_stock_quantity’ );

function wc_default_variation_stock_quantity() {
global $pagenow, $woocommerce;

$default_stock_quantity = 1;
$screen = get_current_screen();

if ( ( $pagenow == ‘post-new.php’ || $pagenow == ‘post.php’ || $pagenow == ‘edit.php’ ) && $screen->post_type == ‘product’ ) {

ob_start();
?>
if ( ” === $( ‘#_stock’ ).val() ) {
$( ‘#_stock’ ).val();
}
add_inline_js( $javascript );
}
}

April 13, 2014 at 5:39 pm 18655
Sk Sk

Hello Jay,

please navigate to dokan/templates/edit/inventory.php at line 19.

replace the line
<?php dokan_post_input_box( $post->ID, '_stock', array( 'placeholder' => '10' ) ); ?>

with
<?php dokan_post_input_box( $post->ID, '_stock', array( 'value' => 1 ) ); ?>

you will get default stock quantity 1 for every new product.

Thank you

Viewing 4 Posts - 1 through 4 (of 4 total)