- Run
npx sanity init
- Select
create new project
- Use the
default
dataset - Select the
E-commerce
template with sample data - Once the studio is initialized,
cd
into the studio and runsanity start
- Go to the Vision pane and select the
v2021-03-25
API version
- Get all data.
- Get the first result.
- Get all products.
- Get the first 10 products.
- Get all products title, ordered alphabetically in ascending order.
- Get all products with a price superior to 10.
- Get all products with the category "Chocolate".
- Get all products, and add a "product_description" property with the product and vendor title, separated by a comma.
- Get all products, and add a "rating" property with a value set to "expensive" if the product price is superior to 10 or "affordable" if the price is lower.
- Get all products, and add a "custom_slug" property with the prefix "/good-deal/" if the product price is inferior to 5, otherwise display the current slug.
- Get all products, and add an "early_bird_price" property with a product price discounted by 25%. The new price should be rounded.
- Get all products, and add an "image_cover" property with the first product image.
- Get all vendors, and add a "brand_color" property with the dominant background color of the vendor logo.
- Get all vendors, and add a "related_products" property with their related products title.