Auto generating slug with custom fields or ID I'm not sure I've seen this exact question, but I'm curious how I can include custom and/or auto-generated parts of a slug. It's not the URI creation, but the slug itself.

For Instance:

{slug}-{id} would turn into lorem-ipsum-dolor-sit-amet-123456 on submit

and from there on the variable {{entry.url}} would be example.com/lorem-ipsum-dolor-sit-amet-123456.

I know ExpressionEngine had an option in the Channel preferences called URL Title Prefix, so this would go along those lines, but more auto-generated than a predefined set of words.

If it changes things, this is specifically for Commerce and Digital Products at the moment.
I think for this you'd want to write a custom plugin that listened to the onSaveEntry event.

That plugin would check that the given entry is in the correct section/entry type you're interested in, pull any data from custom fields set on the entry update the slug for that entry accordingly.

I'd probably look at updating the slug directly in the database and avoid going back through craft()-&gt;entries-&gt;saveEntry() to avoid getting into an infinite save entry loop.