Skip to content

Commit 7a458bd

Browse files
authored
Merge pull request #998 from w3bdesign/996-upgrade-all-plugins
996 upgrade all plugins
2 parents 045d98b + dbb14cf commit 7a458bd

File tree

10 files changed

+159
-148
lines changed

10 files changed

+159
-148
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ Optional plugin:
3737
The current release has been tested and is confirmed working with the following versions:
3838

3939
- WordPress version 6.1.1
40-
- WooCommerce version 7.1.0
41-
- WP GraphQL version 1.5.0
42-
- WooGraphQL version 0.6.2
40+
- WooCommerce version 7.4.0
41+
- WP GraphQL version 1.13.8
42+
- WooGraphQL version 0.12.0
4343
- WPGraphQL CORS version 2.1
4444

4545
2. For debugging and testing, install either:

components/Cart/Cart.component.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import Link from 'next/link';
44
import { AppContext } from 'utils/context/AppContext';
55

66
/**
7-
* Displays the shopping cart contents.
8-
* Currently only displays a sample cart.
7+
* Displays the shopping cart contents. *
98
* Displays amount of items in cart.
109
*/
1110
const Cart = ({ stickyNav }) => {

components/Cart/CartPage/CartItem.component.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const CartItem = ({
2626
</td>
2727
<td className="px-4 py-2 border">
2828
<img
29-
width="64"
29+
className="w-[70px]"
3030
src={item.image.sourceUrl}
3131
srcSet={item.image.srcSet}
3232
alt={item.image.title}

components/Cart/CartPage/CartItemsContainer.component.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ const CartItemsContainer = () => {
8585
<section className="py-8 bg-white">
8686
<div className="container flex flex-wrap items-center mx-auto">
8787
{requestError && <div className="p-6 mx-auto mt-5">Error ... </div>}
88+
8889
{cart ? (
8990
<div className="p-6 mx-auto mt-5">
9091
<RegularCart

components/Product/SingleProduct.component.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const SingleProduct = ({ product }) => {
9494
{product.stockQuantity && (
9595
<p
9696
v-if="data.product.stockQuantity"
97-
class="pt-1 mt-4 mb-4 text-2xl text-gray-900"
97+
className="pt-1 mt-4 mb-4 text-2xl text-gray-900"
9898
>
9999
{product.stockQuantity} på lager
100100
</p>

package-lock.json

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

pages/produkt/[slug].js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const Produkt = ({ product }) => {
1616
return (
1717
<>
1818
<Header title={`- ${product.name ? product.name : ''}`} />
19+
1920
{product ? (
2021
<SingleProduct product={product} />
2122
) : (

utils/functions/functions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ export const getFormattedCart = (data) => {
8585
return formattedCart;
8686
}
8787
const givenProducts = data.cart.contents.nodes;
88+
8889
// Create an empty object.
8990
formattedCart = {};
9091
formattedCart.products = [];
9192
let totalProductsCount = 0;
9293
let i = 0;
9394
givenProducts.forEach(() => {
94-
const givenProduct = givenProducts[parseInt(i, 10)].product;
95+
const givenProduct = givenProducts[parseInt(i, 10)].product.node;
96+
9597
const product = {};
9698
// Convert price to a float value
9799
const convertedCurrency = givenProducts[parseInt(i, 10)].total.replace(
@@ -101,12 +103,14 @@ export const getFormattedCart = (data) => {
101103

102104
product.productId = givenProduct.productId;
103105
product.cartKey = givenProducts[parseInt(i, 10)].key;
106+
104107
product.name = givenProduct.name;
108+
105109
product.qty = givenProducts[parseInt(i, 10)].quantity;
106110
product.price = convertedCurrency / product.qty;
107111
product.totalPrice = givenProducts[parseInt(i, 10)].total;
108112
// Ensure we can add products without images to the cart
109-
product.image = givenProduct.image
113+
product.image = givenProduct.image.sourceUrl
110114
? {
111115
sourceUrl: givenProduct.image.sourceUrl,
112116
srcSet: givenProduct.image.srcSet,
@@ -125,6 +129,7 @@ export const getFormattedCart = (data) => {
125129
});
126130
formattedCart.totalProductsCount = totalProductsCount;
127131
formattedCart.totalProductsPrice = data.cart.total;
132+
128133
return formattedCart;
129134
};
130135

utils/gql/GQL_MUTATIONS.js

Lines changed: 92 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,53 @@ export const ADD_TO_CART = gql`
55
cartItem {
66
key
77
product {
8-
id
9-
databaseId
10-
name
11-
description
12-
type
13-
onSale
14-
slug
15-
averageRating
16-
reviewCount
17-
image {
8+
node {
189
id
19-
sourceUrl
20-
altText
21-
}
22-
galleryImages {
23-
nodes {
10+
databaseId
11+
name
12+
description
13+
type
14+
onSale
15+
slug
16+
averageRating
17+
reviewCount
18+
image {
2419
id
2520
sourceUrl
2621
altText
2722
}
23+
galleryImages {
24+
nodes {
25+
id
26+
sourceUrl
27+
altText
28+
}
29+
}
2830
}
2931
}
3032
variation {
31-
id
32-
databaseId
33-
name
34-
description
35-
type
36-
onSale
37-
price
38-
regularPrice
39-
salePrice
40-
image {
33+
node {
4134
id
42-
sourceUrl
43-
altText
44-
}
45-
attributes {
46-
nodes {
35+
databaseId
36+
name
37+
description
38+
type
39+
onSale
40+
price
41+
regularPrice
42+
salePrice
43+
image {
4744
id
48-
attributeId
49-
name
50-
value
45+
sourceUrl
46+
altText
47+
}
48+
attributes {
49+
nodes {
50+
id
51+
attributeId
52+
name
53+
value
54+
}
5155
}
5256
}
5357
}
@@ -73,49 +77,54 @@ export const UPDATE_CART = gql`
7377
items {
7478
key
7579
product {
76-
id
77-
databaseId
78-
name
79-
description
80-
type
81-
onSale
82-
slug
83-
averageRating
84-
reviewCount
85-
image {
80+
node {
8681
id
87-
sourceUrl
88-
altText
89-
}
90-
galleryImages {
91-
nodes {
82+
databaseId
83+
name
84+
description
85+
type
86+
onSale
87+
slug
88+
averageRating
89+
reviewCount
90+
image {
9291
id
9392
sourceUrl
9493
altText
9594
}
95+
galleryImages {
96+
nodes {
97+
id
98+
sourceUrl
99+
altText
100+
}
101+
}
96102
}
97103
}
104+
98105
variation {
99-
id
100-
databaseId
101-
name
102-
description
103-
type
104-
onSale
105-
price
106-
regularPrice
107-
salePrice
108-
image {
106+
node {
109107
id
110-
sourceUrl
111-
altText
112-
}
113-
attributes {
114-
nodes {
108+
databaseId
109+
name
110+
description
111+
type
112+
onSale
113+
price
114+
regularPrice
115+
salePrice
116+
image {
115117
id
116-
attributeId
117-
name
118-
value
118+
sourceUrl
119+
altText
120+
}
121+
attributes {
122+
nodes {
123+
id
124+
attributeId
125+
name
126+
value
127+
}
119128
}
120129
}
121130
}
@@ -127,23 +136,32 @@ export const UPDATE_CART = gql`
127136
removed {
128137
key
129138
product {
130-
id
131-
databaseId
139+
node {
140+
id
141+
databaseId
142+
}
132143
}
133144
variation {
134-
id
135-
databaseId
145+
node {
146+
id
147+
databaseId
148+
}
136149
}
137150
}
138151
updated {
139152
key
140153
product {
141-
id
142-
databaseId
154+
node {
155+
id
156+
databaseId
157+
}
143158
}
159+
144160
variation {
145-
id
146-
databaseId
161+
node {
162+
id
163+
databaseId
164+
}
147165
}
148166
}
149167
}

0 commit comments

Comments
 (0)