How can I redirect a
SEO URL Key of a Simple product of which the visibility is set to "Not Individually Visible" to the parent Configurable Product SEO URL Key?
There are two important conditions that needs to be met:
the options on the Configurable Product page should be correctly preselected to display the attributes of the Simple product.
the price for the Single Product also needs to be displayed correctly.
Configurable Product P1 has two attributes. Each attribute has two options:
Attribute A1 has option O1 and O2 Attribute A2 has option O3 and O4
So Configurable Product P1 has 4 Configurations represented by 4 Simple Products with each a different price:
P2: O1 and O3 -> EUR 1 P3: O1 and O4 -> EUR 2 P4: O2 and O3 -> EUR 3 P5: O2 and O4 -> EUR 4
The problem that needs to be solved is that for each Configuration the parent Configurable Product URL Key is sent to Google Merchant Shopping as an XML feed.
But when Google is verifying the prices of the Configurations on the parent Configurable Product URL page the prices won't match for
P3, P4 and P5 as by default the lowest price is shown by Magento. And this in turn will result in the following warning in Google Merchant:
"Insufficient match of microdata price information". In the above example 75% of the data isn't matching.
I already took a look at How redirect simple products of Configurable product but it is referring to an event which to my understanding does not exists in Magento 2:
I also tried the suggestions at Magento2 Event Observer Redirect Simple Product to Configurable Product but it seems that the Plugin can only work if the product visibility is not set to "Not Individually Visible".
So I suspect that the canShow method defined in
Magento/Catalog/Helper/Product.php is called before the
Magento/Catalog/Controller/Product/View is executed but I have an hard time figuring out where this happens.
How does Magento determine that an URL key is representing a product?
And where are the product id, category id and options parameters derived from the URL key to be passed on to the execute method in
Any help would be much appreciated.