Author Topic: Update parent stock when child is ordered  (Read 933 times)

Dimi

  • Beginner
  • *
  • Posts: 14
  • A beginner
Update parent stock when child is ordered
« on: April 06, 2021, 13:42:42 pm »
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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10253
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Update parent stock when child is ordered
« Reply #1 on: April 06, 2021, 16:35:56 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1207
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Update parent stock when child is ordered
« Reply #2 on: April 06, 2021, 17:08:29 pm »
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 from products, orders and database table
Virtuemart Email Manager - customs email templates

Dimi

  • Beginner
  • *
  • Posts: 14
  • A beginner
Re: Update parent stock when child is ordered
« Reply #3 on: April 07, 2021, 11:10:25 am »
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