October 2017
Intermediate to advanced
370 pages
8h 57m
English
We could use submit-success and amp-mustache to display an appropriate confirmation or error message as we did earlier. This time, however, we'll show a summary of the cart on successful form submission. We can implement this as a div container fixed to the bottom of the viewport.
The basic setup is the same as before. We add the submit-success attribute to a container div, and we include the mustache template inside this div, using {{cart_total_price}} to grab the total cart price from the JSON data:
<div submit-success class="overlay"> <template type="amp-mustache"> <div class="cart-price">Sub-total: €{{cart_total_price}}</div> <div id="cart"> {{#cart_items}} ... {{/cart_items}} </div> </template> ...Read now
Unlock full access