fix(admin): WC settings link uses siteUrl + /wp-admin

The wpAdminUrl config already includes admin.php?page=woonoow,
so constructing /admin.php?page=wc-settings on top of it was wrong.

Now uses siteUrl + /wp-admin for external WC links.
This commit is contained in:
Dwindi Ramadhana
2026-01-08 10:22:26 +07:00
parent 068fbe3a26
commit 83836298ec

View File

@@ -31,7 +31,8 @@ interface ShippingZone {
export default function ShippingPage() { export default function ShippingPage() {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const wcAdminUrl = (window as any).WNW_CONFIG?.wpAdminUrl || '/wp-admin'; // Use siteUrl + /wp-admin since wpAdminUrl already includes admin.php?page=woonoow
const wcAdminUrl = ((window as any).WNW_CONFIG?.siteUrl || '') + '/wp-admin';
const [togglingMethod, setTogglingMethod] = useState<string | null>(null); const [togglingMethod, setTogglingMethod] = useState<string | null>(null);
const [selectedZone, setSelectedZone] = useState<any | null>(null); const [selectedZone, setSelectedZone] = useState<any | null>(null);
const [showAddMethod, setShowAddMethod] = useState(false); const [showAddMethod, setShowAddMethod] = useState(false);
@@ -481,8 +482,7 @@ export default function ShippingPage() {
<div className="font-medium" dangerouslySetInnerHTML={{ __html: rate.name }} /> <div className="font-medium" dangerouslySetInnerHTML={{ __html: rate.name }} />
<div className="flex items-center gap-2 text-sm text-muted-foreground mt-1"> <div className="flex items-center gap-2 text-sm text-muted-foreground mt-1">
<span className="font-semibold" dangerouslySetInnerHTML={{ __html: rate.price }} /> <span className="font-semibold" dangerouslySetInnerHTML={{ __html: rate.price }} />
<span className={`text-xs px-2 py-0.5 rounded-full ${ <span className={`text-xs px-2 py-0.5 rounded-full ${rate.enabled
rate.enabled
? 'bg-green-100 text-green-700' ? 'bg-green-100 text-green-700'
: 'bg-gray-100 text-gray-600' : 'bg-gray-100 text-gray-600'
}`}> }`}>
@@ -695,8 +695,7 @@ export default function ShippingPage() {
<div className="font-medium text-sm line-clamp-1" dangerouslySetInnerHTML={{ __html: rate.name }} /> <div className="font-medium text-sm line-clamp-1" dangerouslySetInnerHTML={{ __html: rate.name }} />
<div className="flex items-center gap-2 text-xs text-muted-foreground mt-0.5"> <div className="flex items-center gap-2 text-xs text-muted-foreground mt-0.5">
<span className="font-semibold" dangerouslySetInnerHTML={{ __html: rate.price }} /> <span className="font-semibold" dangerouslySetInnerHTML={{ __html: rate.price }} />
<span className={`px-1.5 py-0.5 rounded-full whitespace-nowrap ${ <span className={`px-1.5 py-0.5 rounded-full whitespace-nowrap ${rate.enabled
rate.enabled
? 'bg-green-100 text-green-700' ? 'bg-green-100 text-green-700'
: 'bg-gray-100 text-gray-600' : 'bg-gray-100 text-gray-600'
}`}> }`}>