POS UI Extension - Navigate to Cart page

Hey!

Is it possible to navigate from a Modal to the POS cart page? I’m reviewing the Navigation API and am looking for something similar to the code below:

import React from 'react';
import {
  reactExtension,
  useApi,
  Navigator,
  Screen,
  Button,
} from '@shopify/ui-extensions-react/point-of-sale';

const SmartGridModal = () => {
  const api = useApi<'pos.home.modal.render'>();

  return (
    <Navigator>
      <Screen name="ScreenOne" title="Screen One Title">
        <Button
          title="Navigate to Cart"
          onPress={() => api.navigation.navigate('Cart')}
        />
      </Screen>
    </Navigator>
  );
};

export default reactExtension('pos.home.modal.render', () => (
  <SmartGridModal />
));

Thank you!

Unfortunately we do not offer this functionality at this time, but I’ve logged your post as a feature request.

1 Like

Thank you for your response!
I was wondering if there’s a way to close the modal instead.
There’s an api.action.presentModal(); function, but is there a similar one for closing the modal window?

Yes, you can use the Navigation API to dismiss the extension modal.

2 Likes