Customize Category Slugs
Hi,
FluentCart has an option in Settings (Store Settings > Product Page) to customize the product slug.
By default: /item/
Can be customized to: /p/ (a better slug for products).
However, there's currently no option to customize the category slug.
By default: /product-categories/
Could be customized to: /c/ (a better slug for categories).
We'd recommend adding this option right below the custom product slug field in the settings.
The following snippet works for now, for anyone who needs it:
add_filter('register_taxonomy_args', function ($args, $taxonomy, $object_type) {
if ($taxonomy === 'product-categories') {
$args['rewrite'] = ['slug' => 'c'];
}
return $args;
}, 10, 3);
Why are /p/ and /c/ better? Is this some kind of standard?
Yes
shorter = better
p = product
c = category
Salesforce Commerce Cloud and other big e-commerce solutions use this URL format