- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Grouped Product Default Quantity bulk set to 0
For my sins I've taken over a M2 website, not had the pleasure of using it since M1.9 4 years ago... it's changed a bit :-)
This store uses Grouped products, with one Item Default Quantity 1 and the rest are Default Quantity 0
Is the a bulk action to default all grouped product to 0 where Default Quantity = 1
or any clue as to which table in the database it is stored, so I can change it via a SQL command?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Grouped Product Default Quantity bulk set to 0
Hello @mallongstoe6b2
- Log in to your Magento 2 database using a tool such as phpMyAdmin or MySQL Workbench.
- Find the table "catalog_product_link_attribute_decimal" and locate the row with the attribute code "qty".
- Copy the "attribute_id" value for the "qty" row. This is typically 76 in a default Magento 2 installation.
- Find the table "catalog_product_link" and execute the following SQL command to update all grouped products with a default quantity of 1 to a default quantity of 0:
UPDATE catalog_product_link SET qty = 0 WHERE link_type_id = 3 AND product_id IN ( SELECT product_id FROM catalog_product_entity_int WHERE attribute_id = [attribute_id] AND value = 1 )
Replace [attribute_id] with the "attribute_id" value you copied in step 3.
This command updates the "qty" value to 0 for all grouped product links where the product has a default quantity attribute of 1.
Make sure you take database backup first.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Grouped Product Default Quantity bulk set to 0
Hi @theMageComp
Step two
Find the table "catalog_product_link_attribute_decimal" and locate the row with the attribute code "qty".
I have the following 4 columns in the catalog_product_link_attribute_decimal table
value_id
product_link_attribute_id
link_id
value
How do I find the row with the attribute code "qty" ?
Cheers
Mal