cancel
Showing results for 
Search instead for 
Did you mean: 

Pre select configurable product in magento 2 PDP

Pre select configurable product in magento 2 PDP

Hi I want whenever someone opens configurable product page with size and color the first child should be preselected

how to achieve this I am using latest Magento 2 version

3 REPLIES 3

Re: Pre select configurable product in magento 2 PDP

Hello @prince_ramgarhi 

 

Please check this answer :

https://magento.stackexchange.com/questions/232072/how-to-make-auto-select-first-child-product-of-co...

 

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Pre select configurable product in magento 2 PDP

Is that good idea to use readymade extension? Should i purchase this?

https://dolphinwebsolution.com/shop/configurable-products-preselect-for-magento.html

Re: Pre select configurable product in magento 2 PDP

To preselect the first child product on a Magento 2 configurable product page:

  1. Ensure all child products have stock and attributes are correctly set.
  2. Magento usually selects the first option automatically, but if not, use JavaScript to trigger the first available swatch on page load.
  3. Add a custom script in your theme’s JS folder and include it in requirejs-config.js.
  4. Deploy changes using Magento CLI commands.

This ensures the first available size and color are auto-selected on page load.