<?php
// test-add-cart.php - For debugging
require_once __DIR__ . '/includes/config.php';
require_once __DIR__ . '/includes/functions.php';

header('Content-Type: application/json');

// Test adding a product to cart
$product_id = 1; // Change to a valid product ID
$quantity = 1;
$variants = ['Size' => 'M'];

$result = addToCart($pdo, $product_id, $quantity, $variants);

echo json_encode([
    'success' => $result,
    'cart' => $_SESSION['cart'] ?? [],
    'count' => getCartCount()
]);
?>