I have a custom post type that always do math operation to its post_meta and other custom post type post_meta.
For example:
- post-type 1 = cpt_product_order
- post-type 1 post_meta = cpt_pm_product_order
- post-type 2 = cpt_product
- post-type 2 post_meta = cpt_pm_product_stock
There’s a cpt_product with cpt_pm_product_stock = 100, frontend operation enable specific user made order by inserting new cpt_product with post_meta cpt_product_order of 10 will substract cpt_pm_product_stock to 90
100 cpt_pm_product_stock – 10 cpt_product_order = 90 cpt_pm_product_stock
cancelling order will delete/trash the cpt_product and cpt_product_order, and cpt_pm_product_stock should back to 100.
Which action hook should used for this operation? Is it trashed_post?
I didn’t find any answer on codex, http://codex.wordpress.org/Plugin_API/Action_Reference/trashed_post is empty
Thanks in advance for an answer. 😉