WooCommerce add_to_cart url not working [closed]

So I ended up making a workaround because I still have no clue what’s happening. I changed the url to point to the product page and I’m using ol’good PHP to get the values and add the product with WooCommerce API.
Here’s my code:

if(isset($_GET['order']) && $_GET['order'] == 'true') {
    $typo = isset($_GET['attribute_pa_typographie']) ? $_GET['attribute_pa_typographie'] : '';
    $contour = isset($_GET['attribute_pa_contour']) ? $_GET['attribute_pa_contour'] : '';
    $departement = isset($_GET['attribute_pa_departement']) ? $_GET['attribute_pa_departement'] : '';
    $percage = isset($_GET['attribute_pa_percage']) ? $_GET['attribute_pa_percage'] : '';
    $plaque = isset($_GET['plaque']) ? $_POST['plaque'] : '';
    $bavette = isset($_GET['bavette']) ? $_POST['bavette'] : '';
    $quantity = isset($_POST['quantity']) && is_numeric($_POST['quantity']) ? (int)$_POST['quantity'] : 1;

    $attrs = [
        'attribute_pa_typographie' => $typo,
        'attribute_pa_contour' => $contour,
        'attribute_pa_departement' => $departement,
        'attribute_pa_percage' => $percage,
        'plaque' => $plaque,
        'bavette' => $bavette
    ];

    WC()->cart->add_to_cart($productID, $quantity, $variationID, $attrs);
    wp_redirect('/panier');
    exit;
}

Not very fancy but it works.
If someone has a better idea, I’m all ears!