• Resolved anthonyflibustiers

    (@anthonyflibustiers)


    Hello, hope you all doing great !

    So , I’ve made a form than add products (url) to cart under conditions, but, as my form is long, I’ve count more than 150 conditions that I should enter manually… So my question is, is there a way to make it simplier ? Can I include url parts directly from fields (query ?) if filled ?

    Hope that’s make sense to you …

    Thanks a lot !

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @anthonyflibustiers

    I hope you’re well today!

    I got a feeling that this might be something that would require custom code but I’m not quite sure yet as it’s not entirely clear for me how this form works/is supposed to work.

    By “adding product (url) to cart” do you mean the form redirects to some 3rd-party cart passing some specific URL via redirect?

    Or do you mean some “cart” built entirely with Forminator?

    If you could explain that a bit more, it would be helpful. It would also be great if we could just take a look at example form.

    You can export the form by going to “Forminator -> Forms” page and clicking on “Export” button from drop-down menu under the little “gear” icon next to form in question. Then the code that you get should be put at pastebin.com service or your Google Drive/Dropbox/similar and you can share direct link to it in response below.

    We could then import form to test site and get better insights into how it works.

    Best regards,
    Adam

    Thread Starter anthonyflibustiers

    (@anthonyflibustiers)

    Hello !

    Thanks for your answer. The form is supposed to add product depending on how the form is filled, via the redirect feature.

    I,ve made an export so you can see how I’ve build it.

    https://pastebin.com/JupmHqU7

    Thanks !

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @anthonyflibustiers

    Thanks for sharing the form!

    I looked into it and while I’m not exactly sure what specific logic drives those conditions (that’s mostly due to language barrier) I can see the “idea” behind and and how it’s built.

    In essence, form redirects to certain URL with different value of “?add-to-cart” parameter and

    – the URL itself seems to be the same in all cases
    – only the number of values (product IDs, I suppose) and values themselves change
    – that depends on certain fields of the form

    Theoretically then, it would be possible to use just one redirect and replace all the numbers with reference to some field that would contain all the IDs.

    But in practice, it would only mean moving those conditions to the form itself together with adding some additional fields to it. While it would make “After submission” settings simpler/clearer, it would in the end complicate things even more and slow down the form.

    The complication here is that those values passed to URLs are arbitrary numbers (so not e.g. calculation of field 1 + field 2 values and so on) and the numbers of values passed also depends on the multiple different fields.

    I gave it a while, trying to find a workaround for that, but ultimately, I’m afraid I was right initially and if it can be simplified, it would still require quite a lot of custom code and code very specific to this use case/scenario.

    As much as I’d love to say otherwise, I don’t thing this could be simplified more using just available options/tools of the plugin.

    Kind regards,
    Adam

    Thread Starter anthonyflibustiers

    (@anthonyflibustiers)

    Adam,

    Thanks for your answer,

    Ok, I get the logic behind this.

    While waiting for your answer i’ve took my trouble patiently and it seems to work as I expected. But I may have to add more condition in the future so I was hoping you could have find another way. Guess you won’t ?? .

    Thanks a lot for your time and answers, and thanks all of you guys for your work.

    Regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add product to cart from field query’ is closed to new replies.