From a47698d5cab6cbe9c763d5ef58f685609a61a7ec Mon Sep 17 00:00:00 2001
From: Unchained
Date: Sat, 21 Mar 2026 13:00:16 +0200
Subject: [PATCH] fix(saleor): Fix remaining WooCommerce references and
configuration
- Fix syntax error in Checkout.ts (extra semicolon)
- Update NewHero.tsx to use Saleor types and store
- Update page.tsx to use Saleor getProducts
- Add Saleor API domain to next.config.ts images config
---
next.config.ts | 10 ++++++++++
src/app/page.tsx | 17 +++++++---------
src/components/home/NewHero.tsx | 32 ++++++++++++++----------------
src/lib/saleor/queries/Checkout.ts | 1 -
4 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/next.config.ts b/next.config.ts
index 4629d1a..25217ff 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -17,6 +17,16 @@ const nextConfig: NextConfig = {
hostname: "minio-api.nodecrew.me",
pathname: "/**",
},
+ {
+ protocol: "https",
+ hostname: "api.manoonoils.com",
+ pathname: "/**",
+ },
+ {
+ protocol: "https",
+ hostname: "**.saleor.cloud",
+ pathname: "/**",
+ },
],
},
};
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 4d3d01f..1ef78b8 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,4 +1,4 @@
-import { getProducts } from "@/lib/woocommerce";
+import { getProducts } from "@/lib/saleor";
import Header from "@/components/layout/Header";
import Footer from "@/components/layout/Footer";
import AnnouncementBar from "@/components/home/AnnouncementBar";
@@ -7,6 +7,7 @@ import StatsSection from "@/components/home/StatsSection";
import FeaturesSection from "@/components/home/FeaturesSection";
import TestimonialsSection from "@/components/home/TestimonialsSection";
import NewsletterSection from "@/components/home/NewsletterSection";
+import ProductCard from "@/components/product/ProductCard";
export const metadata = {
title: "ManoonOils - Premium Natural Oils for Hair & Skin",
@@ -17,15 +18,14 @@ export const metadata = {
export default async function Homepage() {
let products: any[] = [];
try {
- products = await getProducts();
+ products = await getProducts("SR");
} catch (e) {
// Fallback for build time when API is unavailable
console.log('Failed to fetch products during build');
}
- const featuredProduct = products.find((p) => p.status === "publish");
- const publishedProducts = products
- .filter((p) => p.status === "publish")
- .slice(0, 4);
+
+ const featuredProduct = products[0];
+ const publishedProducts = products.slice(0, 4);
return (
@@ -61,7 +61,7 @@ export default async function Homepage() {
{publishedProducts.map((product, index) => (
-
+
))}
@@ -72,6 +72,3 @@ export default async function Homepage() {
);
}
-
-// Import ProductCard here to avoid circular dependency
-import ProductCard from "@/components/product/ProductCard";
diff --git a/src/components/home/NewHero.tsx b/src/components/home/NewHero.tsx
index aedcaf2..4e5d236 100644
--- a/src/components/home/NewHero.tsx
+++ b/src/components/home/NewHero.tsx
@@ -4,30 +4,28 @@ import { motion } from "framer-motion";
import { Star, ShoppingBag } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
-import { useCartStore } from "@/stores/cartStore";
-import { WooProduct, formatPrice, getProductImage } from "@/lib/woocommerce";
+import { useSaleorCheckoutStore } from "@/stores/saleorCheckoutStore";
+import type { Product } from "@/types/saleor";
+import { getProductPrice, getProductImage, formatPrice } from "@/lib/saleor";
interface NewHeroProps {
- featuredProduct?: WooProduct;
+ featuredProduct?: Product;
}
export default function NewHero({ featuredProduct }: NewHeroProps) {
- const { addItem, openCart } = useCartStore();
+ const { addLine, openCart } = useSaleorCheckoutStore();
- const handleAddToCart = () => {
- if (featuredProduct) {
- addItem({
- id: featuredProduct.id,
- name: featuredProduct.name,
- price: featuredProduct.price,
- quantity: 1,
- image: getProductImage(featuredProduct),
- sku: featuredProduct.sku,
- });
+ const handleAddToCart = async () => {
+ const variant = featuredProduct?.variants?.[0];
+ if (variant?.id) {
+ await addLine(variant.id, 1);
openCart();
}
};
+ const price = featuredProduct ? getProductPrice(featuredProduct) : "";
+ const image = featuredProduct ? getProductImage(featuredProduct) : "";
+
return (
{/* Background Image */}
@@ -63,7 +61,7 @@ export default function NewHero({ featuredProduct }: NewHeroProps) {
{/* Product Image */}
- {featuredProduct.short_description?.replace(/<[^>]*>/g, "") ||
+ {featuredProduct.description?.replace(/<[^>]*>/g, "").slice(0, 100) ||
"Premium natural oil for hair and skin care"}
@@ -107,7 +105,7 @@ export default function NewHero({ featuredProduct }: NewHeroProps) {
- {formatPrice(featuredProduct.price)}
+ {price}
50ml
diff --git a/src/lib/saleor/queries/Checkout.ts b/src/lib/saleor/queries/Checkout.ts
index 79e4fc5..e8a6556 100644
--- a/src/lib/saleor/queries/Checkout.ts
+++ b/src/lib/saleor/queries/Checkout.ts
@@ -18,4 +18,3 @@ export const GET_CHECKOUT_BY_ID = gql`
}
${CHECKOUT_FRAGMENT}
`;
-`;