Skip to content

Commit

Permalink
Update functions.js
Browse files Browse the repository at this point in the history
  • Loading branch information
w3bdesign committed Mar 5, 2021
1 parent 72f2fe6 commit 8eca108
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions utils/functions/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { v4 as uuidv4 } from 'uuid';
import WOO_CONFIG from 'utils/config/nextConfig';

/**
* Shorten inputted string (usually product description) to a maximum of 20 characters
* Shorten inputted string (usually product description) to a maximum of length
* @param {String} string The string that we input
* @param {Integer} length The length that we want to shorten the text to
*/
Expand Down Expand Up @@ -46,18 +46,14 @@ export const getFloatVal = (string) => {
*/
export const getFormattedCart = (data) => {
let formattedCart = null;

if (!data || !data.cart.contents.nodes.length) {
return formattedCart;
}

const givenProducts = data.cart.contents.nodes;

// Create an empty object.
formattedCart = {};
formattedCart.products = [];
let totalProductsCount = 0;

let i = 0;
givenProducts.forEach(() => {
const givenProduct = givenProducts[parseInt(i, 10)].product;
Expand Down

0 comments on commit 8eca108

Please sign in to comment.