One of our clients had a unique product type requirement that led to a custom Magento 2 solution. This client sells items that can be engraved and focuses specifically on memorializing those killed in combat or as victims of terror. The site has a database of names of those casualties, and this list of names serves as the main product type for the website.
When shopping on this site, customers can start with a person’s name, then select the item they want engraved with that name. Because of this, that name needs to be searchable and filterable, not unlike a product. Our client wanted their customers to be able to select a name, then customize the different products for engraving on the same page. This setup could be considered a configurable bundle, however that is not an inherit functionality in Magento.
In order to achieve this two-step setup, our team created a custom product type where a user selects a parent product (name) and then one of the child products (item to be engraved), and can then set the configurations for that product all on the same page.
The Customization Process
To begin the process, our team took a good look at Magento 2’s bundle product functionality and, using that as a base, started in on developing the customizations like:
- Removing the default quantity attached to the child products
- Removing limitations that prevented the addition of a simple product with custom options
Once those customizations were complete, the back end of the product type was in place.
At this point, our team could create a new name product type and add child products as selections in the back end, but the page was not configured on the front end. To resolve this, our team customized a block used to load out all of the custom options for each child product.
From there, Magento’s built-in custom options selector was used to display the options on the page. So, on page load, our team loaded in the custom options for the child types, then displayed the selected options on the page.
With this in place, products could be added to the cart and the custom options would be configured with them, however the price was not updated correctly.
With the implementation of some custom Java script, the price box was able to update based on the custom options selected.
Throughout all of this, the biggest challenge for our development team was learning the nitty-gritty of how product types work in Magento 2. This is code that is very rarely changed or added to, so these customizations were an adventure into unchartered territory for our team. But, using Magento 2 training and experience, our team was able to solve the client’s challenge.