News:

Support the VirtueMart project and become a member

Main Menu

Update parent stock when child is ordered

Started by Dimi, April 06, 2021, 13:42:42 PM

Previous topic - Next topic

Dimi

Hello,
I have an e-shop with clothes. I have created parent products (eg dress) and children products for the different sizes.
I am connecting them with the multi variant custom field.
My problem is that when a child gets ordered, the parent stock is not updated.

eg. The parent has in stock 6 and every child has 2 (3 children). If one of the children is ordered, its stock get decreased but the parent stock is not affected.

I want the parent stock to change every time a child's stock changes. I need it this way because my client wants to check her inventory and know how many products are available.

Versions
Joomla! 3.9.24
VirtueMart 3.6.10 10211
php 7.3


Thank you in advance.

GJC Web Design

You would need a plugin to do this...

would need to be written as I know of none available
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

pinochico

Confirm

But because we have import products online from 3 supliers and synchronize stock with ERP online too, then we don't have plugin, but custom solution with OPC from Rupostel call by CLI cron :)
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Dimi

Hello,

Unfortunatelly we can't afford buying a plugin right now, but I am thinking of a workaround.

I am thinking of changing the sql query that updates the child stock to also update the parent stock. Could someone tell me where I can find the sql query that updates the product stock when an item is bought?

Thanks again