day-cohort-70 / bangazon-api-i-like-planes-api

bangazon-api-i-like-planes-api created by GitHub Classroom
0 stars 0 forks source link

Feature: Add to cart greyed out when product is out of stock #62

Open Justin-Acosta opened 2 days ago

Justin-Acosta commented 2 days ago

given a user is on an individual product's page and the product being displayed is out of stock (product.quantity = 0) then the "Add To Cart" button will be unclickable and the "Add To Cart" button will be a lighter color

API

models/product.py: a "sold_out" decoration should be added to the if product.quantity > 0: "sold_out" should equal True if product.quantity = 0: "sold_out" should equal False

views/products.py: "sold_out" should be included in the ProductSerializer

Client

components/products/detail.js: "Add to Cart" button should be conditionally rendered based on the product.sold_out property in the product state