Custom page slugs for catalog URLs

All URLs for products and categories are generated using the same format:

{domain}/store/productName-p123456

{domain}/store/categoryName-c123456

Where productName/categoryName is the name of product or category and p123456/c123456 is the ID of product or category.

With custom page slugs product and catalog URLs can look like:

{domain}/store/best-product

{domain}/store/my-category

Store owners can add custom page slugs for product and category pages in their Ecwid admin. For Instant Sites and official CMS plugins, Ecwid handles all of the backend logic of storing redirects and applying them on the storefront.

If you want to use a custom CMS with an Ecwid store added to one of its pages, then you need to handle custom page slugs on your side.

How Ecwid handles slug data in REST API

For product and category pages, Ecwid has the following fields:

{
	"url": "https://example.com/store/Shoes-p123",
	"autogeneratedSlug": "shoes",
	"customSlug": ""
}

URL - stores product or category URL in non-custom format.
autogeneratedSlug - page slug generated by Ecwid automatically.
customSlug - custom page slug defined by the store owner. Overrides autogenerated slug.

How to get custom page slugs

When you start handling custom slugs, parse the store catalog and save all product and category IDs with non-empty "customSlug" on your side. Then apply redirect rules for these pages.

After that, you can subscribe to the 'product.updated' webhook event and check if the "customSlug" field was changed or got a non-empty value for each received webhook.

There's also an endpoint for searching specific pages by their slug. In response, you can receive both slug information and static page code. This method allows making updates of store SEO data on custom websites faster.