Top

Set up a Default Donation Amount Selection in the Widget

To set up a default donation amount selection in the widget, follow these steps:

  1. From "Shopify Admin", select Online Store.

    Online Store 

  2. Select Actions.

    Select Actions 

  3. Select Edit code.

    Select Edit code 

  4. Under "Templates", select product.liquid.

    Note: If your template contains sections, you will need to select the product-template.liquid section instead.

    select product.liquid 

  5. Paste this code to the bottom of the file:

    <script>
    $( document ).ready(function() {
    
    $( "input[value='####']" ).attr('checked',true);
    
    });
    </script>

    paste this code

  6. Replace #### with the value of the radio button.

     replace the hash tags with the value of the radio button

  7. Select Save.

    select save 

That's it

You can find the value of a radio button by right-clicking on the radio button and selecting "inspect element" in the menu that appears on the screen. This will cause the browser console to open which will display the page's HTML. The HTML for the radio button that was right clicked on should be highlighted in the console, and the line should have a value attribute on it (ex. value="3454"). The number in quotations is the value of the radio button. For more information on how to use the console visit Change the Styling or Display Settings of an App. The above code will apply to all donation manager widgets on all product pages, so if you wanted to have different default selections for different

The above code will apply to all donation manager widgets on all product pages. If you wanted to have different default selections for different donation groups, you would need to create a separate product template in your theme's files, put in a separate version of the code, and then apply that template to the product with that donation group assigned to it.  Visit Create alternate templates on the Shopify site for more information.