I’m using ACF to create product links :
I have a function that is called on save_post_product
that looks something like this :
That function syncs the inventory in the linked ACF row perfectly because you can only update the stock of one product at a time.
However, when I try to call this with woocommerce_thankyou
it breaks because it only updates the inventory once on the first item and doesn’t take in consideration the inventory management of the possible product B in the same cart.
How would I go about combining the cart items together and setting the correct stock afterwards?
Right now, if only one product from the row is in the cart, it works fine. If both products from the row are in the cart, the calculation only happens on the first product and it ignores the second product.
Thank you
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com