File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,7 +160,11 @@ class Cart extends Component {
160160 return acc ;
161161 } , [ ] ) ;
162162
163- return `Products ${ products . join ( ', ' ) } are out of stock. Please remove them to complete the checkout.` ;
163+ return (
164+ < span >
165+ Products < strong > { products . join ( ', ' ) } </ strong > are out of stock. Please remove them to complete the checkout.
166+ </ span >
167+ ) ;
164168 }
165169
166170 return sanitizeAll ( err ) ;
Original file line number Diff line number Diff line change 8181 .place-order-button {
8282 border-radius : 0 ;
8383 }
84+
85+ .error-alerts {
86+ margin-left : 15px ;
87+ }
8488}
8589
8690@media (--large) {
Original file line number Diff line number Diff line change @@ -118,8 +118,26 @@ class Checkout extends Component {
118118
119119 @autobind
120120 sanitizeError ( error ) {
121- if ( error && error . startsWith ( 'Not enough onHand units' ) ) {
122- return 'Unable to checkout — item is out of stock' ;
121+ if ( / F o l l o w i n g S K U s a r e o u t / . test ( error ) ) {
122+ const skus = error . split ( '.' ) [ 0 ] . split ( ':' ) [ 1 ] . split ( ',' ) ;
123+
124+ const products = _ . reduce ( skus , ( acc , outOfStock ) => {
125+ const sku = _ . find ( this . props . cart . skus , { sku : outOfStock . trim ( ) } ) ;
126+ if ( sku ) {
127+ return [
128+ ...acc ,
129+ sku . name ,
130+ ] ;
131+ }
132+
133+ return acc ;
134+ } , [ ] ) ;
135+
136+ return (
137+ < span >
138+ Products < strong > { products . join ( ', ' ) } </ strong > are out of stock. Please remove them to complete the checkout.
139+ </ span >
140+ ) ;
123141 } else if ( / i s b l a c k l i s t e d / . test ( error ) ) {
124142 return 'Your account has been blocked from making purchases on this site' ;
125143 }
@@ -293,6 +311,7 @@ class Checkout extends Component {
293311 < ErrorAlerts
294312 sanitizeError = { this . sanitizeError }
295313 error = { props . checkoutState . err }
314+ styleName = "error-alerts"
296315 />
297316 { this . content }
298317 </ div >
You can’t perform that action at this time.
0 commit comments