0

I am working on a store that is comprised of mostly configurable products. I am importing and adding products from a suppliers API into the magento store. My command is running fine. However, I can't seem to find a way for the simple products to share an image.

For EG, my command will save 'Shirt-Black-Default.jpg' in the catalog folder. I would like the different size variations of Shirt Black to use the same image to save space. However, when I use $product->addImageToMediaGallery()... no matter what it will always create a duplicate of the saved image, even if the parameter is the path of the image already in pub/media/catalog/product.

Is it possible in Magento 2 for multiple products to share the same image?

1 Answer 1

0

Check this out https://docs.magento.com/user-guide/catalog/product-create-configurable.html#step-3-configure-the-images-price-and-quantity maybe it helps.

However, at import level you will probably have to check how Magento does this so that you can use the same mechanism when creating the parent product.

Worth noting that I didn't try this myself, but I think it might be what you are looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.