Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Merge branch 'trunk' into fix/8765-rest-api-products-block-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
imanish003 authored Apr 18, 2023
2 parents 24a2f8e + 08278f4 commit 8fdbb43
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ table.wc-block-cart-items td {
background: none !important;
// Remove borders on default themes.
border: 0;
margin: 0 0 2em;
margin: 0;
}

.editor-styles-wrapper table.wc-block-cart-items,
Expand Down
8 changes: 6 additions & 2 deletions assets/js/blocks/cart/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
}
}
}
}

.wc-block-cart {
.wc-block-components-totals-taxes,
.wc-block-components-totals-footer-item {
margin: 0;
}

table.wc-block-cart-items,
table.wc-block-cart-items th,
table.wc-block-cart-items td {
margin: 0 0 2em;
}
}

// Loading placeholder state.
Expand Down
11 changes: 9 additions & 2 deletions assets/js/data/cart/push-changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,20 @@ const isBillingAddress = (
export const normalizeAddress = ( address: BillingOrShippingAddress ) => {
const trimmedAddress = Object.entries( address ).reduce(
( acc, [ key, value ] ) => {
//Skip normalizing for any non string field
if ( typeof value !== 'string' ) {
acc[ key as keyof BillingOrShippingAddress ] = value;
return acc;
}

if ( key === 'postcode' ) {
acc[ key as keyof BillingOrShippingAddress ] = value
.replace( ' ', '' )
.toUpperCase();
} else {
acc[ key as keyof BillingOrShippingAddress ] = value.trim();
return acc;
}

acc[ key as keyof BillingOrShippingAddress ] = value.trim();
return acc;
},
{} as BillingOrShippingAddress
Expand Down
2 changes: 1 addition & 1 deletion src/BlockTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ function( $template ) {
$template->description = BlockTemplateUtils::get_block_template_description( $template->slug );
}

if ( 'single-product' === $template->slug ) {
if ( str_contains( $template->slug, 'single-product' ) ) {
if ( ! is_admin() && ! BlockTemplateUtils::template_has_legacy_template_block( $template ) ) {

$new_content = SingleProductTemplateCompatibility::add_compatibility_layer( $template->content );
Expand Down

0 comments on commit 8fdbb43

Please sign in to comment.