Skip to content

Commit

Permalink
Merge pull request #356 from w3bdesign/develop
Browse files Browse the repository at this point in the history
Show regular price if on sale
  • Loading branch information
w3bdesign authored Feb 16, 2021
2 parents 7d25d99 + 03b2dc6 commit 6e7d8e4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
5 changes: 2 additions & 3 deletions components/Product/SingleProduct.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
import AddToCartButton from 'components/Cart/AddToCartButton.component';
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component';

import WOO_CONFIG from 'utils/config/nextConfig';
import WOO_CONFIG from 'utils/config/nextConfig';

/**
* Shows a single product with an Add To Cart button.
Expand Down Expand Up @@ -58,7 +58,6 @@ const SingleProduct = ({ product }) => {
src={WOO_CONFIG.PLACEHOLDER_LARGE_IMAGE_URL}
/>
)}

<div className="ml-8">
<p className="text-3xl font-bold text-left">{name}</p>
<br />
Expand Down Expand Up @@ -110,7 +109,7 @@ const SingleProduct = ({ product }) => {
)}
<div className="pt-1 mt-2">
{
// Display default AddToCart button if we dont have variations. If we do, send the variationId to AddToCart button
// Display default AddToCart button if we do not have variations. If we do, send the variationId to AddToCart button
}
{product.variations ? (
<AddToCartButton product={selectedVariation} />
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-woocommerce",
"version": "1.0.11",
"version": "1.0.12",
"description": "NextJS WooCommerce webshop",
"main": "index.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions utils/gql/GQL_QUERIES.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { gql } from '@apollo/client';
export const GET_SINGLE_PRODUCT = gql`
query Product($id: ID!) {
product(id: $id, idType: DATABASE_ID) {
id
databaseId
id
databaseId
averageRating
slug
description
onSale
image {
id
uri
Expand All @@ -17,10 +18,14 @@ export const GET_SINGLE_PRODUCT = gql`
}
name
... on SimpleProduct {
salePrice
regularPrice
price
id
}
... on VariableProduct {
salePrice
regularPrice
price
id
paColors {
Expand Down

1 comment on commit 6e7d8e4

@vercel
Copy link

@vercel vercel bot commented on 6e7d8e4 Feb 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.