Automated WooCommerce
October 20, 2016 9:44 AM   Subscribe

Any developers out there use WooCommerce? Anyone know how to write a PHP script that creates downloadable products from a script?

I've found an explanation out there which I can't seem to get to work. It is not all that straightforward, calling for an MD5 hash and an array that becomes serialized with the hash as a key (?). Does anyone know if there's a good way to do this? Any help much appreciated.
posted by johngoren to Computers & Internet (2 answers total)
 
Best answer: I took a look at the API docs, particularly Create a Product and Product Properties. Using the PHP wrapper, would something along these lines work (it's their Create a Product PHP example with downloadable set to true and the download added)? http://pastebin.com/3BaufhTL

Please excuse any errors.
posted by michaelh at 2:31 PM on October 20, 2016


Anyone know how to write a PHP script that creates downloadable products from a script?

It's entirely possible to do that, but it's maybe unlikely you'll find sample code online that is close enough to what you want. Does the product need to remain available for future purchase or is it a one-time download? (Consider that most digital downloads should remain available for a week or so in case people delete the file accidentally or whatever.) Do you need to do some custom action like watermark a PDF which is then downloaded?

Bunch more questions you need to ask I think. Feel free to memail me.
posted by iffthen at 3:09 AM on October 27, 2016


« Older Where to put "virtual tables" in MVC?   |   Barely remembered quote about talkative women and... Newer »
This thread is closed to new comments.