{% set permissionsToView = { 'commerce/orders': 'commerce-manageOrders', 'commerce/products': 'commerce-manageProducts', 'commerce/promotions': 'commerce-managePromotions', 'commerce/shipping/shippingmethods': 'commerce-manageShipping', 'commerce/tax/taxrates': 'commerce-manageTaxes', 'commerce/subscriptions': 'commerce-manageSubscriptions', } %} {% set permission = permissionsToView[craft.commerce.settings.defaultView] ?? null %} {% if craft.commerce.settings.defaultView and permission and currentUser.can(permission) %} {% redirect craft.commerce.settings.defaultView %} {% endif %} {% if currentUser.can('commerce-manageOrders') %} {% redirect 'commerce/orders' %} {% endif %} {% if currentUser.can('commerce-manageProducts') %} {% redirect 'commerce/products' %} {% endif %} {% if currentUser.can('commerce-managePromotions') %} {% redirect 'commerce/promotions' %} {% endif %} {% if currentUser.can('commerce-manageShipping') %} {% redirect 'commerce/shipping/shippingmethods' %} {% endif %} {% if currentUser.can('commerce-manageTaxes') %} {% redirect 'commerce/tax/taxrates' %} {% endif %} {% if currentUser.can('commerce-manageSubscriptions') %} {% redirect 'commerce/subscriptions' %} {% endif %} {% exit 403 %}