Discussing APIs and development related to customers, discounts, and order management.
Hi Guys,
I tried following this tutorial https://shopify.dev/docs/apps/selling-strategies/discounts/discount-function-examples/order-minimum-... to Create Shopify Discount Function app
After following all of the steps I am getting following error:
Can anyone help me with this?
I think adding I18nContext to `app/routes/app.jsx` as follows will solve the problem.
import {I18nContext, I18nManager} from '@shopify/react-i18n'; // <-- add code
export default function App() {
const { apiKey, host } = useLoaderData();
const [config] = useState({ host, apiKey });
const i18nManager = new I18nManager({ // <-- add code
locale: 'en'
});
return (
<AppProvider isEmbeddedApp apiKey={apiKey}>
<I18nContext.Provider value={i18nManager}> // <-- add code
<DiscountProvider>
<Outlet />
</DiscountProvider>
</I18nContext.Provider>. // <-- add code
</AppProvider>
);
}
I have tried adding the same code, but I still encounter an error.
I had the same issue until I realized <Outlet/> was not inside the DiscountProvider Tag. Should be