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

Commit 9c51ded

Browse files
Aljulludinhtungdu
authored andcommitted
Fix alignment of Add to Cart form block (#8578)
1 parent fd781da commit 9c51ded

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/BlockTemplatesController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace Automattic\WooCommerce\Blocks;
33

44
use Automattic\WooCommerce\Blocks\Domain\Package;
5+
use Automattic\WooCommerce\Blocks\Templates\BlockTemplatesCompatibility;
56
use Automattic\WooCommerce\Blocks\Templates\ProductAttributeTemplate;
67
use Automattic\WooCommerce\Blocks\Utils\BlockTemplateUtils;
78

@@ -324,6 +325,14 @@ function( $template ) {
324325
$template->description = BlockTemplateUtils::get_block_template_description( $template->slug );
325326
}
326327

328+
if ( 'single-product' === $template->slug ) {
329+
if ( ! is_admin() ) {
330+
$new_content = BlockTemplatesCompatibility::wrap_single_product_template( $template->content );
331+
$template->content = $new_content;
332+
}
333+
return $template;
334+
}
335+
327336
return $template;
328337
},
329338
$query_result

0 commit comments

Comments
 (0)