File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -3,17 +3,16 @@ import { v4 as uuidv4 } from 'uuid';
3
3
import WOO_CONFIG from 'utils/config/nextConfig' ;
4
4
5
5
/**
6
- * Shorten inputted string (usually product description) to a maximum of 20 characters
6
+ * Shorten inputted string (usually product description) to a maximum of length
7
7
* @param {String } string The string that we input
8
8
* @param {Integer } length The length that we want to shorten the text to
9
9
*/
10
10
export const trimmedStringToLength = ( string , length ) => {
11
11
if ( string . length > length ) {
12
12
const subStr = string . substring ( 0 , length ) ;
13
13
return subStr + '...' ;
14
- } else {
15
- return string ;
16
14
}
15
+ return string ;
17
16
} ;
18
17
19
18
/**
@@ -46,18 +45,14 @@ export const getFloatVal = (string) => {
46
45
*/
47
46
export const getFormattedCart = ( data ) => {
48
47
let formattedCart = null ;
49
-
50
48
if ( ! data || ! data . cart . contents . nodes . length ) {
51
49
return formattedCart ;
52
50
}
53
-
54
51
const givenProducts = data . cart . contents . nodes ;
55
-
56
52
// Create an empty object.
57
53
formattedCart = { } ;
58
54
formattedCart . products = [ ] ;
59
55
let totalProductsCount = 0 ;
60
-
61
56
let i = 0 ;
62
57
givenProducts . forEach ( ( ) => {
63
58
const givenProduct = givenProducts [ parseInt ( i , 10 ) ] . product ;
You can’t perform that action at this time.
0 commit comments