Skip to content

Commit

Permalink
fix(checkout-button): handle 10+ product variations (#1536)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpeixe authored Sep 26, 2023
1 parent b14e4e5 commit 5df5065
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/blocks/checkout-button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function CheckoutButtonEdit( props ) {
// Handle product variation data.
if ( data?.variations?.length ) {
setAttributes( { is_variable: true } );
apiFetch( { path: `/wc/v2/products/${ data.id }/variations` } )
apiFetch( { path: `/wc/v2/products/${ data.id }/variations?per_page=100` } )
.then( res => setVariations( res ) )
.catch( () => setVariations( [] ) );
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/modal-checkout/modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
opacity: 0.5;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
transform: translate( -50%, -50% );
width: 100%;
> span {
animation: spin 1s infinite linear;
Expand Down Expand Up @@ -84,6 +84,8 @@
.newspack-blocks-variation-modal {
&__content {
padding: 32px;
overflow: auto;
border-radius: 5px;
h3 {
margin: 0 0 1em;
}
Expand Down

0 comments on commit 5df5065

Please sign in to comment.