The only which I know is to use 2 config files and a bit of hacking.
First config file must be loaded BEFORE your commerce
link provider is defined, which unfortunately means you must put it not in the Include
folder but ideally inside the same folder where commerce
link provider is configured:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<linkManager>
<providers>
<add name="commerce" type="Wrong.Type">
</add>
</providers>
</linkManager>
</sitecore>
</configuration>
This config file define commerce
link provider with Wrong.Type
on purpose. It will allow us to remove the provider later if it's not updated with the correct settings.
The second config file must be added after the default config with commerce
link provider, so in Include/zzz
or any folder which works for you best:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<linkManager>
<providers>
<add name="commerce">
<patch:attribute name="lowercaseUrls">true</patch:attribute>
</add>
<add type="Wrong.Type">
<patch:delete />
</add>
</providers>
</linkManager>
</sitecore>
</configuration>
It contains a commerce
provider with <patch:attribute>' for
lowercaseUrlsattribute and
element for any provider with type equal to
Wrong.Type`.
So how does it work now?
- New provider with
name="commerce" type="Wrong.Type" lowercaseUrls="true"
attributes is defined.
- If there is now a proper config with proper attributes for
commerce
provider, Sitecore will merge based on the name
of the providers and will replace the Wrong.Type
with proper type of the provider.
- And the second custom config first sets
lowercaseUrls
url to true
and then deletes any provider with Wrong.Type
type. If proper config doesn't exist, provider defined in 1. will be removed. Otherwise nothing will be removed cause proper config changed type of the provider earlier.