Home › Forums › WoodMart support forum › How to Bulk Edit Initial number in stock
How to Bulk Edit Initial number in stock
- This topic has 13 replies, 2 voices, and was last updated 12 months ago by Luke Nielsen.
-
AuthorPosts
-
November 23, 2023 at 3:50 pm #514955
z976937999ParticipantI have 2000 items, how can I batch edit Initial number in stock attribute?
November 23, 2023 at 5:01 pm #514993
Luke NielsenKeymasterHello,
In the Dashboard -> Products, open the “Screen options” and increase the items per page, thus you can bulk for 500 or more products.
Kind Regards
November 23, 2023 at 5:03 pm #514994
z976937999ParticipantCan you edit the ‘Initial number in stock’ attribute, I don’t see an option for it in the bulk edit area.
November 23, 2023 at 6:09 pm #515012
Luke NielsenKeymasterHello,
Please read the below article for help:
https://ithemelandco.com/blog/bulk-edit-product-stock-in-woocommerce/
Thank you for your time.
Kind Regards
- This reply was modified 1 year ago by Luke Nielsen.
November 24, 2023 at 1:18 pm #515251
z976937999ParticipantThere is no attribute here like I want to set, I want to set the ‘Initial number in stock’ attribute in bulk, if there is no good way to do this, can you tell me which table and field in the database can set this attribute?
Attachments:
You must be logged in to view attached files.November 24, 2023 at 1:48 pm #515258
Luke NielsenKeymasterHello,
In the
woodmart_total_stock_quantity
field ofwp_postmeta
table.Thank you for your time.
Kind Regards
November 24, 2023 at 1:53 pm #515262
z976937999ParticipantCan you write me a SQL to change the woodmart_total_stock_quantity field to 100 for all the products, it will help me a lot.
November 24, 2023 at 4:36 pm #515337
Luke NielsenKeymasterHello,
Sorry, but such Customization is not included in our support, it is beyond our limitations and support policy scope. Hope you can understand our limitations.
Don’t hesitate to let me know if you need any further help or any other info
Kind Regards
November 24, 2023 at 6:57 pm #515366
z976937999ParticipantIs there any plugin or method to bulk edit this attribute, the method in the above reply can only bulk edit the stock attribute provided by woocommerce, but not ‘Initial number in stock’.
November 27, 2023 at 10:20 am #515759
Luke NielsenKeymasterHello,
The “Initial number in stock” is provided by WooCommerce as well, so I suggest you contact their support team for further solutions because our theme cannot influence the functionality that comes from WooCommerce.
Thank you for your time.
Kind Regards
November 27, 2023 at 11:27 am #515802
z976937999ParticipantBut this attribute has the field ‘woodmart_total_stock_quantity’ in the database, are you sure it’s a woocommerce attribute?
November 28, 2023 at 11:38 am #516257
Luke NielsenKeymasterHello,
I apologize for the confusion we experienced.
Paste the below code to the child theme.
add_action( 'woocommerce_product_bulk_edit_end', function () { ?> <div class="inline-edit-group dimensions"> <label class="alignleft"> <span class="title"> <?php esc_html_e( 'Initial number in stock', 'woodmart' ); ?> </span> <span class="input-text-wrap"> <select class="change_dimensions change_to" name="change_woodmart_total_stock_quantity"> <option value=""><?php esc_html_e( '— No change —', 'woocommerce' ); ?></option> <option value="1"><?php esc_html_e( 'Change to:', 'woocommerce' ); ?></option> </select> </span> </label> <label class="change-input"> <input type="text" name="woodmart_total_stock_quantity" class="text stock woodmart_total_stock_quantity" placeholder="<?php esc_attr_e( 'Initial number in stock', 'woodmart' ); ?>" value=""> </label> </div> <?php }); add_action( 'save_post_product', function () { if ( ! isset( $_GET['post'] ) || ! isset( $_GET['change_woodmart_total_stock_quantity'] ) || ! $_GET['change_woodmart_total_stock_quantity'] || ! isset( $_GET['woodmart_total_stock_quantity'] ) ) { //phpcs:ignore return; } $posts_id = woodmart_clean( $_GET['post'] ); //phpcs:ignore $option = wp_kses( $_GET['woodmart_total_stock_quantity'], true ); //phpcs:ignore if ( $posts_id ) { foreach ( $posts_id as $id ) { update_post_meta( $id, 'woodmart_total_stock_quantity', $option ); } } } );
Kind Regards
November 28, 2023 at 12:38 pm #516284
z976937999ParticipantThanks, my problem has been solved
November 28, 2023 at 12:44 pm #516288
Luke NielsenKeymasterHello,
You are welcome!
If you do not mind, can you please leave 5 stars rating for our theme by going here: http://themeforest.net/downloads It will allow us to release more updates and provide dedicated support in future. It would encourage our work a lot.
Have a good day!
Kind Regards
-
AuthorPosts
Tagged: stock
The topic ‘How to Bulk Edit Initial number in stock’ is closed to new replies.
- You must be logged in to create new topics. Login / Register