Skip to content

Commit 36e52d7

Browse files
authored
Merge pull request #230 from w3bdesign/dev
Show sale price for individual product
2 parents 05a57ea + 5faee65 commit 36e52d7

File tree

5 files changed

+70
-59
lines changed

5 files changed

+70
-59
lines changed

apollo/queries/GET_SINGLE_PRODUCT_QUERY.gql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ query Product($id: ID!) {
44
averageRating
55
slug
66
description
7+
onSale
78
image {
89
databaseId
910
uri
@@ -14,10 +15,14 @@ query Product($id: ID!) {
1415
name
1516
... on SimpleProduct {
1617
price
18+
salePrice
19+
regularPrice
1720
databaseId
1821
}
1922
... on VariableProduct {
2023
price
24+
salePrice
25+
regularPrice
2126
databaseId
2227
paColors {
2328
nodes {

components/Cart/ShowCartContents.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export default {
7878
query: GET_CART_QUERY,
7979
result({ data, loading, networkStatus }) {
8080
const cartIsReady = data && networkStatus === 7
81-
8281
if (cartIsReady && !loading) {
8382
this.loading = false
8483
this.remoteCart = data
@@ -101,13 +100,11 @@ export default {
101100
methods: {
102101
async handleRemoveProduct(products) {
103102
this.removingCartItem = true
104-
105103
const updatedItems = []
106104
updatedItems.push({
107105
key: products.key,
108106
quantity: 0,
109107
})
110-
111108
try {
112109
await this.$apollo
113110
.mutate({

components/Products/ShowSingleProduct.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
:alt="product.name"
2121
:src="process.env.placeholderSmallImage"
2222
/>
23-
2423
<div class="ml-8">
2524
<p class="text-3xl font-bold text-left">{{ product.name }}</p>
26-
2725
<div v-if="product.onSale" class="flex">
2826
<p class="pt-1 mt-4 text-3xl text-gray-900">
2927
{{ product.salePrice }}
@@ -32,16 +30,13 @@
3230
{{ product.regularPrice }}
3331
</p>
3432
</div>
35-
3633
<p v-else class="pt-1 mt-4 text-2xl text-gray-900">
3734
{{ product.price }}
3835
</p>
39-
4036
<br />
4137
<p class="pt-1 mt-4 text-2xl text-gray-900">
4238
{{ stripHTML(product.description) }}
4339
</p>
44-
4540
<p
4641
v-if="product.variations"
4742
class="pt-1 mt-4 text-xl text-gray-900"
@@ -55,7 +50,6 @@
5550
VARIATION
5651
</select>
5752
</p>
58-
5953
<div class="pt-1 mt-2">
6054
<AddToCartButton v-if="product.variations" :product="product" />
6155
<AddToCartButton v-else :product="product" />

package-lock.json

Lines changed: 63 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"graphql-tag": "^2.11.0",
2323
"nuxt": "^2.14.12",
2424
"swiper": "^6.4.11",
25-
"tailwindcss": "npm:@tailwindcss/[email protected].2",
25+
"tailwindcss": "npm:@tailwindcss/[email protected].3",
2626
"uid": "^2.0.0",
2727
"vue": "^2.6.12",
2828
"vue-awesome-swiper": "^4.1.1",
@@ -41,7 +41,7 @@
4141
"babel-core": "7.0.0-bridge.0",
4242
"babel-eslint": "^10.1.0",
4343
"babel-jest": "^26.6.3",
44-
"eslint": "^7.19.0",
44+
"eslint": "^7.20.0",
4545
"eslint-config-prettier": "^7.2.0",
4646
"eslint-loader": "^4.0.2",
4747
"eslint-plugin-nuxt": "^2.0.0",

0 commit comments

Comments
 (0)