I have been thinking about a WordPress/WooCommerce project which would sell material by weight based on an external feed of the price per Kilogram of said material; but I have a disconnect in my understanding of how the process could carry through the checkout process.
Each product would have a weight but no hard price set in WooCommerce. The price would be calculated set on the front end product page every 30 seconds or so, using the external feed.
Set a cookie perhaps? I have no idea how the rest of this process might play out.
I somehow run the pricing update on the server side in PHP every 30 seconds, and then query the pricing info from WooCommerce on the frontend with an Ajax call every 30 seconds.
How might one go about updating the price so regularly on the server side? I assume that there is a hook to set the price, but cannot find any with a cursory search. Would it be a matter of running a PHP file from cron every 30 seconds?
Is it reasonable to be running a price update so frequently from the back end?
Alternatively, am I approaching this all wrong?
I would appreciate any thoughts, as mine don't seem complete!
Many thanks for reading!