Actions are markers on a DOM element that allow you to interact with the FastSpring Store Builder Library through HTML. They are used to initiate a behavior against the FastSpring Store Builder Library. These directives typically require three parts:
- The Store Builder Library Script
- A path to a specific product – “data-fsc-item-path=…”
- The action you are wanting to perform – “data-fsc-action=…”
These fill the element that the action is applied to. In the opening tag you will provide the path and the action you want to perform. An example will look like this:
<button data-fsc-item-path-value="phot-io-main-app" data-fsc-action="Add">
Add to Cart
</button>
Actions
- Add – Product level action which adds item to cart – only changes selected from false to true – does not effect quantity. Note: Requires product path as defined by fsc-item-path-value
- Checkout – Action for immediate checkout Note: Does not require anything else. Can just put data-fsc-action=”Checkout” in button or can be chained with “Add” and an item path.
- Direct to PayPal Checkout – Action for immediate checkout with PayPal Note: Does not require anything else. Can just put data-fsc-action=”Checkout” in button or can be chained with “Add” and an item path.
- Promocode – Allows application of a coupon through a script or page element Note: Requires an input for data-fsc-promocode-value and a button for data-fsc-action
- Remove – Removes PRODUCT from cart – sets quantity to 1 and selected to false Note: Requires product path defined by fsc-item-path-value
- Replace – Used on an upsell to replace current item in cart with upsell Note: Only works on upsells and requires data-fsc-item-path-value to the upsell product
- Reset – Allows for the cart to be completely emptied Note: Does not require anything else. Can just put data-fsc-action=”Reset” in button
- TaxId – Allows application of a VAT exemption code Note: Requires an input for data-fsc-order-taxId and a button for data-fsc-action. Use fastspring.builder.taxId
- Update – Allows you to specify the quantity of an item. Note: Requires product path defined by fsc-item-path-value and the nearest input/select field
- ViewCart – Allows you open the FastSpring popup on the cart section directly for the current session
- Chained Actions – Allows you to chain several action together on a single button click. Note: Will require any html directives of included actions.