Skip to content

Commit 6e7d8e4

Browse files
authored
Merge pull request #356 from w3bdesign/develop
Show regular price if on sale
2 parents 7d25d99 + 03b2dc6 commit 6e7d8e4

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

components/Product/SingleProduct.component.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
33
import AddToCartButton from 'components/Cart/AddToCartButton.component';
44
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component';
55

6-
import WOO_CONFIG from 'utils/config/nextConfig';
6+
import WOO_CONFIG from 'utils/config/nextConfig';
77

88
/**
99
* Shows a single product with an Add To Cart button.
@@ -58,7 +58,6 @@ const SingleProduct = ({ product }) => {
5858
src={WOO_CONFIG.PLACEHOLDER_LARGE_IMAGE_URL}
5959
/>
6060
)}
61-
6261
<div className="ml-8">
6362
<p className="text-3xl font-bold text-left">{name}</p>
6463
<br />
@@ -110,7 +109,7 @@ const SingleProduct = ({ product }) => {
110109
)}
111110
<div className="pt-1 mt-2">
112111
{
113-
// Display default AddToCart button if we dont have variations. If we do, send the variationId to AddToCart button
112+
// Display default AddToCart button if we do not have variations. If we do, send the variationId to AddToCart button
114113
}
115114
{product.variations ? (
116115
<AddToCartButton product={selectedVariation} />

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-woocommerce",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"description": "NextJS WooCommerce webshop",
55
"main": "index.js",
66
"scripts": {

utils/gql/GQL_QUERIES.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import { gql } from '@apollo/client';
33
export const GET_SINGLE_PRODUCT = gql`
44
query Product($id: ID!) {
55
product(id: $id, idType: DATABASE_ID) {
6-
id
7-
databaseId
6+
id
7+
databaseId
88
averageRating
99
slug
1010
description
11+
onSale
1112
image {
1213
id
1314
uri
@@ -17,10 +18,14 @@ export const GET_SINGLE_PRODUCT = gql`
1718
}
1819
name
1920
... on SimpleProduct {
21+
salePrice
22+
regularPrice
2023
price
2124
id
2225
}
2326
... on VariableProduct {
27+
salePrice
28+
regularPrice
2429
price
2530
id
2631
paColors {

0 commit comments

Comments
 (0)