I have developed a custom build on woocommerce.
All is fine except for the checkout page.
The site ships to UK only, and i have Flat Rate shipping enabled.
However, on the checkout page there are two issues. The first is an invalid argument in a foreach loop:
Warning: Invalid argument supplied for foreach() in /home/****/public_html/wp-content/plugins/woocommerce/includes/class-wc-shipping.php on line 291
And the second problem is:
There doesnât seem to be any available shipping methods. Please double check your address, or contact us if you need any help.
I am bashing my head against a wall here. I have a shipping method enabled, so why is it continuing to tell me there is no method available?
All i want it to do there is simply list all the shipping methods i have enabled so the user can select one.
I also noticed that the shipping methods display when user is not logged in, but when they are logged in it shows Flat Rate - then a random price that isn't entered anywhere in admin.
To elaborate a little. This problem does not occur if i add a variable product to the art using the ?add-to-cart url, but as soon as i use the add_to_cart function it causes those errors.
woocommerce->cart->add_to_cart(522,1, 523,array("attribute_colour" => "colour","attribute_size" => "a3", "attribute_invoice-numbering" => "yes", "attribute_quantity-column" => "yes", "attribute_cc-type" => "duplicate"));
The above code works fine if it is used in a URL, but i want to call it via ajax with the function.