flGravity

flGravity supports this item

Supported

This author's response time can be up to 5 business days.

42 comments found.

WWJD818

WWJD818 Purchased

Hi,

I purchased your product hoping I can create a “buy now” button with 2 variables (qty & size). I can’t seem to figure it out since your subscription option is the only one showing me the variables. Could you help me out?

My license # is 410814f5-0bf0-4ea5-8c5c-35bc2401b818

Hi! Subscription button in my demo has a dropdown with possible options and there is JS code that reads your selection and then it just sets data-[attr] for PayNow! button.

Please check plugin documentation in “Plugin API” section and there you can see method api.setVar(name, value) that allows to set any parameter that PayPal can recognize , like price or quantity.

So what you should do is create dropdown or checkboxes, then add JS code that can check selection and update PayNow! button using its api.setVar() method.

WWJD818

WWJD818 Purchased

Could you help with that? I looked at the Plugin API section and here’s what i have.

<select id=”pn7_select” name=”quantity”> <option value=””>Select Quantity</option> <option value=”1”>1</option> <option value=”2”>2</option> <option value=”3”>3</option> <option value=”4”>4</option> <option value=”5”>5</option> </select>

<select id=”pn7_select” name=”os1”> <option value=””>Select Size</option> <option value=”Small”>Small</option> <option value=”Medium”>Medium</option> <option value=”Large”>Large</option> <option value=”X-Large”>X Large</option> <option value=”2-Large”>2X Large</option> <option value=”3X-Large”>3X Large</option> </select>

<button id=”pn7” class=” btn btn-dark btn-lg btn-appear mt20 paynow-button-disabled” data-business=”arnold.davtyan@gmail.com” data-item_name=”AACA T-Shirt” data-currency_code=”USD” data-os1=”Option” data-amount=”16.99” data-quantity=”Option” > Place Order </button>

I want the “data-quantity” to record the value from the qty selection. Same with os1 to record the value from size selection. Could you help?

Sorry for delay with reply. First of all IDs of select elements should be different.

 <select id="select1">…</select>
 <select id="select2">…</select>

PayNow! button should be like so

<button id=”pn7” class=” btn btn-dark btn-lg btn-appear mt20 paynow-button-disabled” data-business=”arnold.davtyan@gmail.com” data-item_name=”AACA T-Shirt” data-currency_code=”USD” data-on1=”Option” data-os1=”” data-amount=”16.99” data-quantity=”1” > Place Order </button>

Now JS code

<script type="text/javascript">
   $(document).ready(function(){

     // init button
    $('#pn7').paynow({type: 'buynow', style: 'default'});

    // Option
    $('#select1').change(function(){
        var pn = $('#pn7').data('paynow-api'), val = $(this).val();
        if(val !== "") {
            pn.enable().setVar('os1', val);
        } else {
            pn.disable();
        }
    });

    // Quantity
    $('#select2').change(function(){
        var pn = $('#pn7').data('paynow-api');
        pn.setVar('quantity', parseInt($(this).val(), 10));
    });

});
</script>

Please test this and if something won’t work, please give me a link.

WWJD818

WWJD818 Purchased

Is there an easy way to allow customers to input their desired quantity (not drop down)?

WeHi! You may have text input field where customer can set a number. But you will then need to write JS code to read this number and assign to data-quantity attribute of a button.

If you want I can prepare example of a code for you.

WWJD818

WWJD818 Purchased

I figured it out on my own. You have an incredibly slow response rate.

by
by
by
by
by
by