Hot to change new product page default values using XML?

Basically we should be able to modify default values by putting value in config node here: http://devdocs.magento.com/guides/v2.1/howdoi/customize_product.html#customizing-existing-fields-and-field-sets

But… It does not work. I suppose it is related to the order in which product_form.xml is formed. But I seems is not able to find out how to force my product_form.xml data to load after Magento2 product_form.xml data…

It is possible to make the default value by creating a new view/adminhtml/ui_component/product_form.xml inside my module with this content:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
        <fieldset name="product-details">
            <field name="sku" formElement="input">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="value" xsi:type="string">1111</item>
                    </item>
                </argument>
            </field>
        </fieldset>
</form>

But it adds new field along with values from Magento2 (so there would be 2 input field). Of course it is possible to create it as formElement=“hidden” but it is not quite right I suppose, as it will still create a hidden input on the page…

Please advice, if you know how to proceed with this.

1 Like