<p>The problem was that <code>.last</code> is deprecated. The correct Product URI should be:</p>
<p><code>{productFamily.inreverse.one.uri}/{slug}</code></p>

CC BY-SA 4.0
2023-06-14T11:47:24.493Z
2023-06-14T11:47:24.493Z
nitech
<p>Confirm that the Product URI format in production is the same as in development. If you are using Project config, you can look in your <code>config/project/commerce/productTypes/&lt;your-product-type&gt;.yaml</code> for the current file format in production.</p>
<p>If correct, you could try resaving a product in production and see if that updates the URL.</p>
<p>If resaving the product works to update the URL, you can resave all products in production with the command:</p>
<p><code>php craft resave/products</code></p>
<p>Which will update the URLs with the current URL format from product type settings.</p>

CC BY-SA 4.0
2023-06-12T11:51:26.563Z
The yaml-file does contain the same on prod (I really meant on dev-environment of hyperlane). '{productFamily.last.uri}/{slug}'. `php craft resave/products` does not do any difference
nitech
CC BY-SA 4.0
2023-06-12T11:54:20.147Z
Just to elaborate: The difference is between ddev local development environment and any environment on the host. To make sure I didn't mess up a lot when going from local environment to host, I deployed all code and then overwrote the whole database via MySQL workbench so the dev on host would be equal to ddev
nitech
CC BY-SA 4.0
2023-06-12T12:14:32.143Z
I suspect there's something wrong with the project config. When I rebuild the local project config so it matches the database, I get a lot of changes. When I deploy these changes, I am able to apply, but the process ends up in "A fatal error has occurred" with status: undefined and response: undefined.
nitech
CC BY-SA 4.0
2023-06-12T15:20:02.347Z
please send in a support ticket to support@craftcms.com also recommend reading https://craftcms.com/docs/4.x/project-config.html#adopting-project-config and https://craftcms.com/knowledge-base/deployment-best-practices
Luke Holder
CC BY-SA 4.0
2023-06-13T08:50:26.007Z
Thanks. Have sent support ticket.
nitech
CC BY-SA 4.0
2023-06-14T08:55:35.307Z
Please see updated question. Do you see a solution now?
nitech
CC BY-SA 4.0
2023-06-12T11:41:32.810Z
2023-06-12T11:41:32.810Z
Luke Holder
<p>I upgraded a Craft CMS 3 site to version 4. The Product URI Format for my products look like this:</p>
<p><a href="https://i.sstatic.net/TzWm2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TzWm2.png" alt="screenshot of slug format {productFamily.last.uri}/{slug} " /></a></p>
<p>Before I re-save a product, the URL displays correctly the way it looked in Craft 3:</p>
<p><a href="https://i.sstatic.net/SKZiZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SKZiZ.png" alt="correct URL" /></a></p>
<p>But when I re-save, the path to the <code>productFamily</code> category is no longer displayed:</p>
<p><a href="https://i.sstatic.net/PoawS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PoawS.png" alt="wrong URL" /></a></p>
<p>Any idea why this is happening? Is <code>{productFamily.last.uri}/{slug}</code> no longer a valid URI format? Or has this something to do with the <a href="https://craftcms.com/blog/entrification" rel="nofollow noreferrer">Entrification Plan</a>?</p>

<plugin-craftcommerce><craft4><slug>
Product URL missing category slug on production site
# Product URL missing category slug on production site

(Asked by: username_0 on 2023-06-12)

I upgraded a Craft CMS 3 site to version 4. The Product URI Format for my products look like this:

[![screenshot of slug format {productFamily.last.uri}/{slug} ](https://i.sstatic.net/TzWm2.png)](https://i.sstatic.net/TzWm2.png)

Before I re-save a product, the URL displays correctly the way it looked in Craft 3:

[![correct URL](https://i.sstatic.net/SKZiZ.png)](https://i.sstatic.net/SKZiZ.png)

But when I re-save, the path to the `productFamily` category is no longer displayed:

[![wrong URL](https://i.sstatic.net/PoawS.png)](https://i.sstatic.net/PoawS.png)

Any idea why this is happening? Is `{productFamily.last.uri}/{slug}` no longer a valid URI format? Or has this something to do with the [Entrification Plan](https://craftcms.com/blog/entrification)?

**Tags:** plugin-craftcommerce, craft4, slug


---

## 2 answers

### Answer by username_0 on 2023-06-14. Score: 0 | Accepted answer

The problem was that `.last` is deprecated. The correct Product URI should be:

`{productFamily.inreverse.one.uri}/{slug}`


---

### Answer by username_1 on 2023-06-12. Score: 1

Confirm that the Product URI format in production is the same as in development. If you are using Project config, you can look in your `config/project/commerce/productTypes/.yaml` for the current file format in production.

If correct, you could try resaving a product in production and see if that updates the URL.

If resaving the product works to update the URL, you can resave all products in production with the command:

`php craft resave/products`

Which will update the URLs with the current URL format from product type settings.

> **Comments:**
> **username_0**: The yaml-file does contain the same on prod (I really meant on dev-environment of hyperlane). '{productFamily.last.uri}/{slug}'. `php craft resave/products` does not do any difference  
> **username_0**: Just to elaborate: The difference is between ddev local development environment and any environment on the host. To make sure I didn't mess up a lot when going from local environment to host, I deployed all code and then overwrote the whole database via MySQL workbench so the dev on host would be equal to ddev  
> **username_0**: I suspect there's something wrong with the project config. When I rebuild the local project config so it matches the database, I get a lot of changes. When I deploy these changes, I am able to apply, but the process ends up in "A fatal error has occurred" with status: undefined and response: undefined.  
> **username_1**: please send in a support ticket to support@craftcms.com also recommend reading https://craftcms.com/docs/4.x/project-config.html#adopting-project-config and https://craftcms.com/knowledge-base/deployment-best-practices  
> **username_0**: Thanks. Have sent support ticket.  
> **username_0**: Please see updated question. Do you see a solution now?  

---

