Plugin Author
Maarten
(@maartenbelmans)
Hi there,
If the text field is required, the direct add-to-cart URL will throw an error like “field X is required”. The only workaround to this is to make the text field not required.
I think you misunderstood me – I’d like to add the required field as well i.e. to add to cart a specific product with some predefined additional field using your plugin. Is this possible?
And to add here some of my tests:
- if I send the add-to-cart url without the specific variable (I’ve got its name from the form) – yes as you suggested it will not be added to the cart
- however if I do include the variable in the url with some value – the product is added to the cart but surprisingly WITHOUT the variable value’s taken into consideration – is this a bug?
Plugin Author
Maarten
(@maartenbelmans)
Your original question was related to the “add to cart” URL, no? Our plugin does not modify that URL. So if you have a required text field, the add to cart URL is still the same: http://domain.com/?add-to-cart=55
But our plugin does trigger add to cart validation so there will be an error because the system is trying to add a product to cart that is missing data (the required field).
Does that make sense?
Done – just to close the case (I asked in my first question “is there also additional variables to pass in addition to b)” – after some more checking of the form you generate it happens that also the variable wapf_field_groups must be passed. In that case it works. So if anyone else needs this the format is the following:
http://domain.com/?add-to-cart=SOMETHING&wapf%5Bfield_SOMETHING%5D=SOMETHING&wapf_field_groups=SOMETHING
where SOMETHING must be replaced with appropriate values based on the specific product’s data.
And just to clarify again – the URL in my initial question was an example “before” and my question is how it should look “after” if I would like to add specific product with specific predefined custom field. In my previous reply I show how to do it and it is doable. Thanks!
-
This reply was modified 1 month, 4 weeks ago by
dingdang.