cancel
Showing results for 
Search instead for 
Did you mean: 

Grouped Product Default Quantity bulk set to 0

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?

2 REPLIES 2

Re: Grouped Product Default Quantity bulk set to 0

Hello @mallongstoe6b2 

 

 

  1. Log in to your Magento 2 database using a tool such as phpMyAdmin or MySQL Workbench.
  2. Find the table "catalog_product_link_attribute_decimal" and locate the row with the attribute code "qty".
  3. Copy the "attribute_id" value for the "qty" row. This is typically 76 in a default Magento 2 installation.
  4. 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.

Was my answer helpful? You can accept it as a solution.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer

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
1683630632_image (3).png