I want to redirect user when button click to this url → https://admin.shopify.com/store/bigapples/discounts
how to do it? I am using Shopify Polaris Remixjs embedded app
A developer needs to redirect users to Shopify’s admin discounts page from a button click within a Shopify Polaris RemixJS embedded app.
Solution provided:
useAppBridge hook and Redirect from App Bridge packagesRedirect.create(app) and dispatch with Redirect.Action.ADMIN_PATHKey technical requirements:
Code example demonstrates the complete implementation using Polaris Button component with the redirect logic.
I want to redirect user when button click to this url → https://admin.shopify.com/store/bigapples/discounts
how to do it? I am using Shopify Polaris Remixjs embedded app
Hello @AlexLew
To redirect a user from a Shopify embedded RemixJS app to an admin URL (like discounts page) such as:
https://admin.shopify.com/store/bigapples/discounts
you must use App Bridge (Shopify’s JS SDK for embedded apps) and the Redirect action.
Here’s how to do it properly:
tsx
Here's how to do it properly:
1. Ensure App Bridge is set up in your Remix app
In your root file (like root.jsx), make sure your app is wrapped with App Bridge using Provider.
import {useAppBridge} from '@shopify/app-bridge-react';
import {Redirect} from '@shopify/app-bridge/actions';
import {Button} from '@shopify/polaris';
export function GoToDiscountsButton() {
const app = useAppBridge();
const handleClick = () => {
const redirect = Redirect.create(app);
redirect.dispatch(Redirect.Action.ADMIN_PATH, {
path: '/discounts'
});
};
return (
);
}
Notes:
. You must use relative admin path (/discounts) with ADMIN_PATH, not full URLs.
. The user must be logged in and have permission to access the /discounts section.
. This works only inside embedded apps using App Bridge.
Thank you ![]()