October 2017
Intermediate to advanced
370 pages
8h 57m
English
We still need to pass the selections to the shopping cart. We can do this by binding the value attribute of hidden input fields in the add-to-cart form. Whenever any of the options are changed, then the hidden fields will automatically be updated, starting with the color and style options:
<input type="hidden" name="color" value="green" [value]="product.color"><input type="hidden" name="style" value="f" [value]="product.style">
We need to tweak the product_id too, so that we can distinguish between different colors or styles of the same t-shirt. We'll use the same method that we used for the image URL, that is, we'll build the style and color into the product_id:
<input type="hidden" name="product_id" ...
Read now
Unlock full access