Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Andreas Wagner

Issue with inline edit of location stock and total stock

Hey there,

we are using your plugin for displaying our stock amount from our different stock locations and also the total stock. For editing the location stocks easyily (without going on the product detail page) we would like inline edit the amount of the location stock (for example when a new produced product arrives a location). The problem we have is that the total stock is the sum of all the location stocks. When i edit a location stock in the product detail backend page i need to press update and the total stock gets its value from the sum of the location stock. When i do the same with inline editing it only updates the location stock and the total stock stays the same. I think this is because the function updating the total stock runs on the post update hook. Is it also possible to this for a inline edit?

Here I explained the issue in a screen video: https://www.loom.com/share/b6b6372ba1824713ac2b7d3267886c25

3 weeks, 5 days ago
Stefan
Developer

You probably use the custom field column to display the different stock values. Our plugin doesn’t know anything about the context of those custom fields. With inline edit, it just changes the value for that specific custom field with the update_post_meta method.

In order to update the total stock, you’ll need to do the calculation yourself and update the total stock custom field. Or if the plugin you’re using has a method for it, you can use that. This can be done after the value is saved by using this hook:

https://github.com/codepress/admin-columns-hooks/blob/master/acp-editing-saved.php

3 weeks, 5 days ago

You must be logged in to reply to this topic.