Support » Plugin: WooCommerce » Including my own calculations in GForm Product Add-ons

  • Hi all,

    I’m building a site for a printing company that allows people to upload a document, specify lots of parameters and then order a print of that document. I’m using Woocommerce (to have a generic and extendable order/payment system) and GForms Product Add-ons (to create a big form as part of the ordering process).

    Now the basic calculations in Product Add-ons aren’t enough for what I need, there is a lot of interaction between all the parameters and the price, so I’m using my own javascript code in the gform_product_total-event to calculate the price. In the form this works, the runtime-displayed price is correct, but the newly calculated price is not sent to the shopping cart.

    In the general GForm-documentation I’m told to ALSO include any custom calculations in PHP-code in the gform_product_info-filter. However, when using GForms in the Product Add-ons extension, this filter doesn’t seem to have any effect at all, any information I update in there is completely ignored. Also, the price is a string there, which doesn’t look like it’s used for any more calculations. All examples I can find are about adding extra sections like taxes or shipping, but not about modifying the actual product price. And, in the Product Add-ons setup, even adding a section doesn’t seem to work.

    So, the basic question: How can I use my own program code to manipulate the product price that is sent by the Product Add-ons extension to the shopping cart?

    And one extra question: Yeah I’m a WordPress newbie haha, what is the legal way of registering my gform_product_total Javascript-event while GForm Product Add-ons has already registered one? For now I fixed this by calling my own gform_product_total_2 from the extension’s gform_product_total() function, which works but it’s not very nice. 🙂

    Thanks for any help!


  • The topic ‘Including my own calculations in GForm Product Add-ons’ is closed to new replies.