Cart total: {cart.total}
-- Customer name: {customer.firstName} {customer.lastName} -
-Currency: {currency}
-Locale: {locale}
-Cart total: {{ cart.total }}
-Customer name: {{ customer.firstName }} {{ customer.lastName }}
-Currency: {{ currency }}
-Locale: {{ locale }}
-- {max} in stock -
-
- Free shipping, arrives by Thu, Apr 7. Want it faster?
-
- Pickup not available at your shop.
-
- Free 30-days returns.
-
- {max} in stock -
-
- Free shipping, arrives by Thu, Apr 7. Want it faster?
-
- Pickup not available at your shop.
-
- Free 30-days returns.
-
-
-We have successfully fetched the list of products from the SAP Commerce Cloud backend and displayed them in the UI. But, the UI is not looking good. Let's use pre-built UI component `ProductCard` from `components` folder to display the product details.
-
-### Using ProductCard Component
-
-We will use the `ProductCard` component to display the product details. Open the `components/ProductCard.tsx` file. As you can see, right now it doesn't accept any props. Let's add the props to the `ProductCard` component.
-
-Replace `ProductCard` in `components/ProductCard.tsx` with:
-
-```tsx
-import { Product } from "@vsf-enterprise/sap-commerce-webservices-sdk";
-import { transformImageUrl } from "@/utils/transformImage";
-
-export default function ProductCard({
- product,
-}: {
- product: Product;
-}) {
- return (
-
-
-
-It's up to you to style the `ProductCard` component as you like, as well as to add more details to it and style the `ProductListingPage` as you like.
-
-Next, let's create a Product Details Page to display the product details.
-
-## Creating a Product Details Page
-
-To create a Product Details Page, we need to create a new dynamic route for the product details page. Create a new directory `app/Product Details/[product_code]` in the `app` directory. Inside the `app/Product Details/[product_code]` directory, create a new file `index.tsx` and add the following code:
-
-```tsx
-import { Text, View } from "@/components/Themed";
-import { sdk } from "@/sdk/sdk.config";
-import { Product } from "@vsf-enterprise/sap-commerce-webservices-sdk";
-import { useLocalSearchParams } from "expo-router";
-import { useEffect, useState } from "react";
-
-export default function ProductDetails() {
- const { product_code } = useLocalSearchParams();
- const [product, setProduct] = useState
-
-Let's complete the Product Details Page by adding the following code:
-
-:::info
-For the sake of this guide, all the necessary third-party libraries are already installed. You are free to use any other third-party libraries to display the product images.
-:::
-
-To simplify the guide, we already prepared the `ProductDetails` page. You can find the complete code for the `ProductDetails` page below:
-
-```tsx
-import { Text, View } from "@/components/Themed";
-import { sdk } from "@/sdk/sdk.config";
-import { transformImageUrl } from "@/utils/transformImage";
-import { Product } from "@vsf-enterprise/sap-commerce-webservices-sdk";
-import { useLocalSearchParams } from "expo-router"
-import { useEffect, useState } from "react";
-import { Dimensions, Image, ScrollView, StyleSheet } from "react-native";
-import Carousel from "react-native-reanimated-carousel";
-
-export default function ProductScreen() {
- const { product_code } = useLocalSearchParams();
- const [product, setProduct] = useState
-
-::info
-You can find complete implementation in the [`product-page` branch](https://github.com/vuestorefront-community/alokai-rn-guide/tree/product-page)
-::
-
-
-## Summary
-
-In this section, we have successfully built a Product Listing Page and Product Details Page with Alokai. We have fetched the list of products from the SAP Commerce Cloud backend and displayed them in the UI using the `ProductCard` component. We have also created a dynamic route for the Product Details Page and displayed the product details on the Product Details Page.
-
-In the next section, we will learn how to work with the cart and add products to the cart.
-
-::card{title="Next: Add product to Cart" icon="tabler:number-6-small" }
-
-#description
-Learn how to use Alokai Connect to add product to cart
-
-#cta
-:::docs-button{to="/guides/alokai-essentials/alokai-react-native/add-to-cart"}
-Next
-:::
diff --git a/docs/content/guides/2.alokai-essentials/2.alokai-react-native/7.add-to-cart.md b/docs/content/guides/2.alokai-essentials/2.alokai-react-native/7.add-to-cart.md
deleted file mode 100644
index 4af6121264..0000000000
--- a/docs/content/guides/2.alokai-essentials/2.alokai-react-native/7.add-to-cart.md
+++ /dev/null
@@ -1,311 +0,0 @@
----
-title: Add product to Cart
-layout: default
-navigation:
- icon: tabler:number-7-small
----
-
-# Add Product to Cart
-
-Just getting the data from the API is not enough. Ecommerce websites are feature rich and one of the most important features is the ability to add products to the cart. In this guide, we will learn how to add products to the cart in Alokai React Native application.
-
-## Add to Cart
-
-First, let's understand the process of adding a product to the cart. When a user clicks on the "Add to Cart" button, the product is added to the cart by it's `cartId`. The cart is a collection of products that the user wants to buy. The cart is stored in the backend and the frontend communicates with the backend to add products to the cart.
-
-In order to achieve this, we will use Alokai SDK method `addToCart`. It will then send a request to Alokai Middleware and the middleware will add the product to the cart.
-
-But that's not all. Since we are building a real-world application, we need to have a cart in a global state. So, let's first do some preparation.
-
-## Preparation
-
-We will create a new `CartContextProvider` component that will provide the cart to the entire application. We will also create a new `useCart` hook that will be used to access the cart from any component.
-
-First, let's create a new `CartContextProvider` component. Create a new file inside `storefront-react-native/providers/CartContextProvider.tsx` and add the following code.
-
-```tsx
-import AsyncStorage from "@react-native-async-storage/async-storage";
-import { Cart } from "@vsf-enterprise/sap-commerce-webservices-sdk";
-import { createContext, useEffect, useState } from "react";
-import { sdk } from "@/sdk/sdk.config";
-
-export const CartContext = createContext<{
- cart: Cart;
- updateCart: (cart: Cart) => void;
-}>({
- cart: {} as Cart,
- updateCart: () => { },
-});
-
-export default function CartContextProvider({ children }: { children: React.ReactNode }) {
- const [cart, setCart] = useState- {{ max }} in stock -
-
- Free shipping, arrives by Thu, Apr 7. Want it faster?
-
- Pickup not available at your shop.
-
- Free 30-days returns.
-
- {{ max }} in stock -
-
- Free shipping, arrives by Thu, Apr 7. Want it faster?
-
- Pickup not available at your shop.
-
- Free 30-days returns.
-
Pickup {product.$custom?.availableForPickup ? '' : 'not'} available
-``` - -And that's it. You can find a complete project example in this repository:By {socialImage.data?.author}
-Pickup {product.$custom?.availableForPickup ? '' : 'not'} available
-``` - -And that's it. You can find a complete project example in this repository:By {socialImage.author}
-
-
-## How to pick data fetching strategy
-
-The rule of thumb is: _always use server-side fetching except for_:
-
-- **lazy loaded data** - data that is not visible immediately on page load and can be removed from server-side rendered html to reduce its size. For example:
- - product reviews should appear only when user clicks expand on the “reviews accordion”
- - content below the fold is fetched on scroll
-
-- **personalized data** - data that is different for each user or group. Fetching such data server side would not only cause flickering but also might cause problem with caching ([read more about caching](/storefront/features/cdn/making-ssr-cacheable)). For example:
- - pricing data might be different for each customer group
- - product recommendations are based on individual user’s journey
- - cart content is specific for each user
-
-## Data fetching in Alokai
-
-Alokai architecture introduces the Middleware in between the front-end application and the APIs. This adds two additional possible routes to our diagram, but most of the traffic should go through the middleware, because:
-
-
-
-- it keeps your architecture simple
-- you can easily monitor middleware traffic in the console
-- enables [data federation](/middleware/guides/federation)
-- ensures middleware reusability and omnichannel capabilities
-
-