I’m an experience .NET developer that’s moving across to Wordpress development, so excuse if I haven’t quite grasped the correct approaches to develop on this platform.
I’m currently developing a bespoke wristband design page for a client and I’ve coded up the page. When the form Add to Basket it clicked I check to see if $_POST[“status”] is set and then I do the following:
$productId = intval($_POST[“spd-design-color”]);
$added = $woocommerce->cart->add_to_cart( $productId, $quantity=1 );
When I check the basket it’s not there and $add is returning null.
Strangely when I look in the debug log it shows the following error:
woocommerce_cart_hash cookie cannot be set
Any ideas where I might be going wrong?