Magento 2 Substitute Products
Table of Contents
- Installation via app/code: Upload the content of the module to your root folder. This will not overwrite the existing Magento folder or files, only the new contents will be added. After the successful upload of the package, run below commands on Magento 2 root directory.
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
- Installation via Composer: Please follow the guide provided in the below link to complete the installation via composer.
Go to Admin > Stores > Configuration > Scommerce Configuration >Substitute Products
- Enabled - Select “Yes” or “No” to enable or disable the module.
- License Key –Please add the license for the extension which is provided in the order confirmation email. Please note license keys are site URL specific. If you require license keys for dev/staging sites then please email us at [email protected]
The substitute product should have exactly same configurations as the main product only the SKU will be different. You can create a duplicate product of the main product while creating a new substitute product.
Go to Admin>Catalog>Products, navigate to your product from the list and click on Edit from the action column. Scroll down to find the Subsitute Products tab. Please refer to the image below:-
Click on Enabled to enable the substitute products for this main product. Add the SKU of the product that you want to add as a substitute of this product and add the priority. In case of multiple substitute products you can set the priortiy highest being 0 so that whenever products are out of stock, upon order placement the SKU will be chosen based on the priority set.
Also, as long as the substitute products attached to the main product are not out of stock the main product on the frontend will never show out of stock.
You can add substitute products for several products such as Simple, Configurable, Bundled etc.
Suppose our main product is out of stock then when a customer visits the storefront they will always see the product available as long as the substiute product assigned is in stock. Orders placed with the main product will be fullfilled with the subsitute product. Place an order with the main product then go to Admin>Sales>Orders, and select your order. We can see the substitute product SKU in the order detail since main product is out of stock.
We place the order with the main product having sku SubstitutetestMain but since this product is out of stock the order should be fullfilled with the substitute product assigned. Now upon placing the order go to My Account>My Orders and view the order, you will be able to see that the order is placed with the substiute product.
If you have a question related to this extension please check out our FAQ Section first. If you can't find the answer you are looking for then please contact [email protected].