Add product descriptionHtml

This commit is contained in:
cond0r 2021-04-05 18:31:20 +03:00
parent 72999092bf
commit f20771a2c3
5 changed files with 6 additions and 11 deletions

View File

@ -136,7 +136,7 @@ const ProductView: FC<Props> = ({ product }) => {
))} ))}
<div className="pb-14 break-words w-full max-w-xl"> <div className="pb-14 break-words w-full max-w-xl">
<Text html={product.description} /> <Text html={product.descriptionHtml ?? product.description} />
</div> </div>
</section> </section>
<div> <div>

View File

@ -165,6 +165,7 @@ interface Entity {
export interface Product extends Entity { export interface Product extends Entity {
name: string name: string
description: string description: string
descriptionHtml?: string
slug?: string slug?: string
path?: string path?: string
images: ProductImage[] images: ProductImage[]

View File

@ -24,18 +24,9 @@ Collection of hooks and data fetching functions to integrate Shopify in a React
## Getting Started ## Getting Started
1. Install dependencies: 1. Environment variables need to be set:
``` ```
yarn add shopify-buy
yarn add @types/shopify-buy
```
3. Environment variables need to be set:
```
SHOPIFY_STORE_DOMAIN=
SHOPIFY_STOREFRONT_ACCESS_TOKEN=
NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN= NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN=
NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN= NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN=
``` ```

View File

@ -93,6 +93,7 @@ export function normalizeProduct(productNode: ShopifyProduct): Product {
images, images,
variants, variants,
description, description,
descriptionHtml,
handle, handle,
priceRange, priceRange,
options, options,
@ -104,6 +105,7 @@ export function normalizeProduct(productNode: ShopifyProduct): Product {
name, name,
vendor, vendor,
description, description,
descriptionHtml,
path: `/${handle}`, path: `/${handle}`,
slug: handle?.replace(/^\/+|\/+$/g, ''), slug: handle?.replace(/^\/+|\/+$/g, ''),
price: money(priceRange?.minVariantPrice), price: money(priceRange?.minVariantPrice),

View File

@ -10,6 +10,7 @@ edges {
vendor vendor
handle handle
description description
descriptionHtml
availableForSale availableForSale
priceRange { priceRange {
minVariantPrice { minVariantPrice {