Select Page
Actions Documentation
Edit on
Codepen.io

data-fsc-action=”Replace”

product-level action for use with upsells only that instructs the Library to remove the product defined in data-fsc-driver-item-path-value from the cart, and replace it with the product defined in data-fsc-item-path-value IF the latter is configured as an upsell for the former (the driver item)


x
51
 
1
<!--
2
    DEMO EXTRA INFO
3
-->
4
Products currently in the cart
5
<!-- Display cart -->
6
<div data-fsc-selections-smartdisplay data-fsc-items-container='shopping-cart' data-fsc-filter="selected=true">
7
</div>
8
9
<!--
10
    DEMO INFO
11
    Please note that this product level directive requires
12
    a second product or variation configured as an upsell 
13
    to work properly. Both "Add" and "Replace" work the same way.
14
     - Add a button for Add or Replace
15
-->
16
<button data-fsc-item-path-value="upsell" data-fsc-action="Add" >
17
    Add to Cart
18
</button>
19
20
<button data-fsc-item-path-value="upsell" data-fsc-driver-item-path-value="phot-io-main-app" data-fsc-action="Replace" >
21
    Replace
22
</button>
23
24
<!--
25
    DEMO SETUP
26
        - Initialize the Store Builder Library
27
        - Add the item with an upsell to the cart
28
        - Build a cart
29
-->
30
<script
31
    id="fsc-api"
32
    src="https://sbl.onfastspring.com/sbl/1.0.2/fastspring-builder.min.js"
33
    type="text/javascript"
34
    data-storefront="fastspringexamples.test.onfastspring.com/popup-fastspringexamples">
35
</script>
36
37
<script type="text/javascript">
38
    fastspring.builder.add('phot-io-main-app')
39
</script>
40
41
<script data-fsc-template-for="shopping-cart" type="text/x-handlebars-template">
42
    <ul>
43
    {{#each items}}
44
        {{#each items}}
45
            <li>
46
                {{this.display}}
47
            </li>
48
        {{/each}}
49
    {{/each}}
50
    </ul>
51
</script>
1
 
1
1
 
1

Related Topics