Move product ID extraction from the Add to Cart form builder function to its own API function.