Select Page
Edit on
Codepen.io

Select product and checkout


x
40
 
1
<!--
2
Initialize the Store Builder Library
3
-->
4
<script
5
    id="fsc-api"
6
    src="https://sbl.onfastspring.com/sbl/1.0.2/fastspring-builder.min.js"
7
    type="text/javascript"
8
    data-storefront="fastspringexamples.test.onfastspring.com/popup-fastspringexamples">
9
</script>
10
11
<select id="product">
12
    <option value="phot-io-main-app">The Phot.io App</option>
13
    <option value="photo-io-main-app-free">The Phot.io App Free</option>
14
    <option value="physical">The Phot.io App Physical Copy</option>
15
    <option value="photo-io-main-app-pro">The Phot.io App Professional</option>
16
</select>
17
18
<button onclick="addProduct();">Add to Cart</button>
19
20
<script>
21
    function addProduct()
22
    {
23
        var e = document.getElementById("product");
24
        var product = e.options[e.selectedIndex].value;
25
        var s =
26
        {
27
            //Reset the cart session  to remove everything added to the cart previously.
28
            'reset':true,
29
            //Define the product path(s) and the quantity to add.
30
            'products' : [
31
                {
32
                    'path':product,
33
                    'quantity': 1
34
                }
35
            ],
36
            'checkout': true
37
        }
38
        fastspring.builder.push(s);
39
    }
40
</script>
1
 
1
1
 
1

Related Topics