diff --git a/admin-spa/src/routes/Products/partials/tabs/OrganizationTab.tsx b/admin-spa/src/routes/Products/partials/tabs/OrganizationTab.tsx index 044a390..706c67e 100644 --- a/admin-spa/src/routes/Products/partials/tabs/OrganizationTab.tsx +++ b/admin-spa/src/routes/Products/partials/tabs/OrganizationTab.tsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { useQueryClient } from '@tanstack/react-query'; import { __ } from '@/lib/i18n'; import { Label } from '@/components/ui/label'; import { Checkbox } from '@/components/ui/checkbox'; @@ -26,6 +27,7 @@ export function OrganizationTab({ selectedTags, setSelectedTags, }: OrganizationTabProps) { + const queryClient = useQueryClient(); const [newCategoryName, setNewCategoryName] = useState(''); const [newTagName, setNewTagName] = useState(''); const [creatingCategory, setCreatingCategory] = useState(false); @@ -46,7 +48,8 @@ export function OrganizationTab({ if (response.id) { setSelectedCategories([...selectedCategories, response.id]); } - // Note: Parent component should refetch categories + // Invalidate categories query to refresh the list + queryClient.invalidateQueries({ queryKey: ['product-categories'] }); } catch (error: any) { toast.error(error.message || __('Failed to create category')); } finally { @@ -183,11 +186,10 @@ export function OrganizationTab({ setSelectedTags([...selectedTags, tag.id]); } }} - className={`px-3 py-1 rounded-full text-sm border transition-colors ${ - selectedTags.includes(tag.id) + className={`px-3 py-1 rounded-full text-sm border transition-colors ${selectedTags.includes(tag.id) ? 'bg-primary text-primary-foreground border-primary' : 'bg-background border-border hover:bg-accent' - }`} + }`} > {tag.name} diff --git a/customer-spa/src/pages/Login/index.tsx b/customer-spa/src/pages/Login/index.tsx index 07a1f6c..57f690e 100644 --- a/customer-spa/src/pages/Login/index.tsx +++ b/customer-spa/src/pages/Login/index.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { useNavigate, useSearchParams, Link } from 'react-router-dom'; import { toast } from 'sonner'; import Container from '@/components/Layout/Container'; @@ -12,6 +12,14 @@ export default function Login() { const [searchParams] = useSearchParams(); const redirectTo = searchParams.get('redirect') || '/my-account'; + // Redirect logged-in users to account page + useEffect(() => { + const user = (window as any).woonoowCustomer?.user; + if (user?.isLoggedIn) { + navigate(redirectTo, { replace: true }); + } + }, [navigate, redirectTo]); + const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); diff --git a/includes/Api/Controllers/CartController.php b/includes/Api/Controllers/CartController.php index b48d109..2a6dde5 100644 --- a/includes/Api/Controllers/CartController.php +++ b/includes/Api/Controllers/CartController.php @@ -365,6 +365,8 @@ class CartController extends WP_REST_Controller { 'total' => $cart_item['line_total'], 'image' => wp_get_attachment_image_url($product->get_image_id(), 'thumbnail'), 'permalink' => $product->get_permalink(), + 'virtual' => $product->is_virtual(), + 'downloadable' => $product->is_downloadable(), ]; } diff --git a/includes/Modules/Licensing/LicenseManager.php b/includes/Modules/Licensing/LicenseManager.php index cb9d238..9e641c6 100644 --- a/includes/Modules/Licensing/LicenseManager.php +++ b/includes/Modules/Licensing/LicenseManager.php @@ -96,7 +96,7 @@ class LicenseManager { if (!$product) continue; // Check if product has licensing enabled - $licensing_enabled = get_post_meta($product_id, '_woonoow_licensing_enabled', true); + $licensing_enabled = get_post_meta($product_id, '_licensing_enabled', true); if ($licensing_enabled !== 'yes') continue; // Check if license already exists for this order item