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';
33import WOO_CONFIG from 'utils/config/nextConfig' ;
44
55/**
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
77 * @param {String } string The string that we input
88 * @param {Integer } length The length that we want to shorten the text to
99 */
1010export const trimmedStringToLength = ( string , length ) => {
1111 if ( string . length > length ) {
1212 const subStr = string . substring ( 0 , length ) ;
1313 return subStr + '...' ;
14- } else {
15- return string ;
1614 }
15+ return string ;
1716} ;
1817
1918/**
@@ -46,18 +45,14 @@ export const getFloatVal = (string) => {
4645 */
4746export const getFormattedCart = ( data ) => {
4847 let formattedCart = null ;
49-
5048 if ( ! data || ! data . cart . contents . nodes . length ) {
5149 return formattedCart ;
5250 }
53-
5451 const givenProducts = data . cart . contents . nodes ;
55-
5652 // Create an empty object.
5753 formattedCart = { } ;
5854 formattedCart . products = [ ] ;
5955 let totalProductsCount = 0 ;
60-
6156 let i = 0 ;
6257 givenProducts . forEach ( ( ) => {
6358 const givenProduct = givenProducts [ parseInt ( i , 10 ) ] . product ;
You can’t perform that action at this time.
0 commit comments