Support » Plugin: Calculated Fields Form » Use woocommerce product quantity in calculated field

  • Resolved jazura



    How can I use the product quantity in a calculated field ?

    More specifically, I have a number field (fieldname5) from which the field value is used in a calculation. What I would like, is to have this field value changed with the product quantity. So every time the user changes the product quantity, this field (and the related calculated fields) changes.

    I understand that I can change the woocommerce product quantity with a field value.
    For example with something like
    <script>jQuery(document).one(‘change’,'[id*=”fieldname5″]’, function(){jQuery(‘[name=”quantity”]’).val(this.value)});</script>

    But I want to work the other way around: change a field value every time the product quantity changes.

    Simple going for
    <script>jQuery(document).one(‘change’,'[name=”quantity”]’, function(){jQuery(‘[id*=”fieldname5″]’).val(this.value)});</script>
    does not work.

    Any suggestions ?

    Best regards


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople


    Hello @jazura

    You only should enter the field’s name, in this case, fieldname5, into the “Field for quantity” attribute in the product’s settings:

    Best regards.

    I saw that in the documentation, but that option was not visible in my back end. Seemed that I simply had to update the plugin.

    Thanks !! Everything works great now !

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.