<?php
require_once '/Users/dwindown/Local Sites/woonoow/app/public/wp-load.php';

$product = new WC_Product_Simple();
$product->set_name('Test API Virtual ' . time());
$product->set_regular_price('10.00');
$product->set_virtual(true);
$product->set_downloadable(true);
$id = $product->save();

$p2 = wc_get_product($id);
echo "Virtual: " . ($p2->is_virtual() ? 'yes' : 'no') . "\n";
echo "Downloadable: " . ($p2->is_downloadable() ? 'yes' : 'no') . "\n";

$p2->set_virtual(false);
$p2->set_downloadable(false);
$p2->save();

$p3 = wc_get_product($id);
echo "Virtual: " . ($p3->is_virtual() ? 'yes' : 'no') . "\n";
echo "Downloadable: " . ($p3->is_downloadable() ? 'yes' : 'no') . "\n";
