Closed (won't fix)
Project:
Ubercart
Version:
6.x-2.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2010 at 01:39 UTC
Updated:
7 Nov 2011 at 16:51 UTC
I added a hook_add_to_cart function to my module Ubercart Product Minimum & Maximum and, in testing, I am finding that the form state (attributes and other custom elements) are not preserved when the result is false and the product form is re-loaded. In my store we have only 6 form elements that customer can set (5 attributes, 1 custom upload) and having to re-select those elements is annoying at best. Should someone have a large number of attributes, having to re-select them all could drive away customers!
Comments
Comment #1
longwaveThis isn't possible from hook_add_to_cart() itself as that is only called at submit time. The best fix would seem to be to add a custom validate callback to the add to cart form and do your validation in there, which would preserve form state.