Based on your requirements, you can either use default buttons on Entity Forms and Entity Lists, or user defined buttons on D365 Portal.
Products with Add to Cart Buttons
1). In Portals, configure Entity Lists to show Products List in portal.
2). In Entity Lists, use Grid Configuration section to configure buttons.
3). Click Create Related Record and configure entity form which you are redirecting to and provide button label name Ex: Add to Cart.
4). In Portals, when user clicks on Add to Cart button on products page, it will redirect him to carts form.
Note: In Grid Configuration, View Actions and Item Actions are default buttons, you can use it as per your requirements.