Skip to content

Mini cart block: add margin and padding supports #59872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/add-spacing-support-minicart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Add margin and padding supports to minicart block
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"multiple": false,
"typography": {
"fontSize": true
},
"spacing": {
"margin": true,
"padding": true
}
},
"example": {
Expand Down
4 changes: 2 additions & 2 deletions plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ protected function render_experimental_iapi_mini_cart( $attributes, $content, $b
$cart = $this->get_cart_instance();

if ( $cart ) {
$classes_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array( 'text_color', 'background_color', 'font_size', 'font_weight', 'font_family', 'extra_classes' ) );
$classes_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes );
$icon_color = isset( $attributes['iconColor']['color'] ) ? esc_attr( $attributes['iconColor']['color'] ) : 'currentColor';
$product_count_color = isset( $attributes['productCountColor']['color'] ) ? esc_attr( $attributes['productCountColor']['color'] ) : '';
$styles = $product_count_color ? 'background:' . $product_count_color : '';
Expand Down Expand Up @@ -754,7 +754,7 @@ protected function get_markup( $attributes ) {
return '';
}

$classes_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array( 'text_color', 'background_color', 'font_size', 'font_weight', 'font_family', 'extra_classes' ) );
$classes_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes );
$wrapper_classes = sprintf( 'wc-block-mini-cart wp-block-woocommerce-mini-cart %s', $classes_styles['classes'] );
$wrapper_styles = $classes_styles['styles'];

Expand Down
Loading