• Resolved OC WordPress Web Designer

    (@oc-wordpress-web-designer)


    I have your shortcode on https://www.stagingdomain.xyz/product/sap-tools/ appear after a dropdown choice of “Select Size” in a table in the tab description.

    Shortcode used: [ajax_add_to_cart product=2699 variation=2885 show_price=b title=none quantity=1 show_quantity=yes]

    The quantity number should always appear as 1, but it shows nothing at first until you click the arrow or put in the quantity -> then it looks normal.

    How can I have the default 1 always show?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author The Rite Sites

    (@theritesites)

    Hi there!

    I am not able to recreate your issue in any way without spending an awful lot of time on it. Can you give me more information?

    – Is this happening when you are not hiding and disabling shortcode/generated inputs? Trying to out-rule a javascript or theme issue.
    – What version of the plugin are you using, as well as PHP version and WordPress version?

    When I am doing testing, all my shortcodes are displaying the default quantity as they should be.

    Hope to hear from you soon!

    Cheers,
    Parker Mathewson
    The Rite Sites

    Thread Starter OC WordPress Web Designer

    (@oc-wordpress-web-designer)

    All versions of everything are current. Only happens when it is conditionally shown. Shortcode in normal page content works correctly.

    It actually shows quantity correctly for the default value of the select dropdown. Then when changing the choice to a new size…and conditionally show a different add to cart shortcode…the size shows blank. Quantity works correctly once inputting a number or using the arrow to choose the amount.

    Note: if you then go back to the default dropdown choice after making a different choice, the quantity value is blank .

    Thanks for the quick response!

    Plugin Author The Rite Sites

    (@theritesites)

    So I cannot really figure out what would be blocking the input from populating with the value attribute. The value attribute is being populated correctly, but the input itself has a different value in the dom.

    If I update the value using javascript like so
    document.querySelector(‘#product_2861_qty’).value = 5
    the quantity input is being updated and would show 5 in this case. Inspect element still shows value=”1″

    When the shortcode is called the html attribute for value is generated and does not change based on user interactions (it is not using javascript to update the html attributes, but is using the standard html input features — the dom — this is not what is seen while inspecting).
    When the user changes the number in the input, the value in inspect element is not updated. Additionally if I as the user put 8 in the input, and then go modify the dom for the html input to have value=”2″, and ask the dom what the value is, it still puts out 8.

    With this in mind, I refreshed the page (new everything) and tried to get the value of one of these inputs. While the html attribute value=”1″ the dom returns a blank string “”.

    This leads me to believe there is some javascript somewhere on your website that is modifying the dom and we can see this in the html input element for this plugin. Because we are seeing this when you change sizes (toggling inputs visible) I am willing to assume the javascript used in this functionality has some unexpected results that we are seeing now.

    Can you take a look to see if there is something in these areas? It is hard to debug on my end with all your javascript assets bundled, but I feel like we are tracking it down!

    Cheers,
    Parker

    Thread Starter OC WordPress Web Designer

    (@oc-wordpress-web-designer)

    The form is built within Gravity Forms and I started to debug, and it is 100% due to a conflict with the “enabling of conditional logic” with another field.

    Plugin Author The Rite Sites

    (@theritesites)

    So to get this working as you intend, you will need to get some sort of additional code in place.

    You can either us actions and filters and php to maybe get the gravity forms conditional logic in place.

    Alternatively, you can use javascript to populate the default value after the page has loaded.
    At this point, I am going to close this ticket. If there is any way we can help you further, please do not hesitate to reach out! I am available at [email protected]

    Cheers,
    Parker

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Quantity Value Doesn’t Appear Initially’ is closed to new replies.