Answer the question
In order to leave comments, you need to log in
What method or query can be used to change the quantity of a particular item in stock?
In the Woocommerce store, I implemented the ability to book goods using the Woocommerce Easy Booking plugin, but this plugin does not provide the ability to pay for the booked goods from the user's account. For products with the status "booked" in the user account in the "Orders" section, I added the action to pay. The problem is that after paying for the goods, the quantity of the goods specified in the order is debited from the warehouse for the second time (the first time when booking the goods) and it turns out that the person ordered 20 goods, and 40 were debited in the total account. At the time of payment for the goods with the status "booked" I want to either remove this product deduction or compensate for it by adding the same amount of product to the warehouse. Can you please tell me which function or request,
Answer the question
In order to leave comments, you need to log in
The quantity of a certain product is stored in post_meta with the key '_stock'. You can update like this.
$id_product = 777;
update_post_meta($id_product, '_stock', '10');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question