You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: src/guides/v2.3/howdoi/checkout/checkout_customize.md
+38-7Lines changed: 38 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -154,16 +154,47 @@ To disable the component in your `checkout_index_index.xml` use the following in
154
154
155
155
## Remove a component {#remove}
156
156
157
-
To remove a component from layout rendering, you need to create a [plugin]({{ page.baseurl }}/extension-dev-guide/plugins.html) for the `\Magento\Checkout\Block\Checkout\LayoutProcessor::process` method. In your plugin, implement the around method removing the corresponding layout nodes at run-time.
157
+
To keep a component from being rendered, create a layout processor. A layout processor consists of a class, implementing
158
+
the `\Magento\Checkout\Block\Checkout\LayoutProcessorInterface` interface, and thus a `LayoutProcessorInterface::process($jsLayout)` method.
159
+
160
+
```php
161
+
<?php
162
+
163
+
namespace <Vendor>\<Module>\Block\Checkout;
164
+
165
+
use Magento\Checkout\Block\Checkout\LayoutProcessorInterface;
166
+
167
+
class OurLayoutProcessor implements LayoutProcessorInterface
168
+
{
169
+
/**
170
+
* @param array $jsLayout
171
+
* @return array
172
+
*/
173
+
public function process($jsLayout)
174
+
{
175
+
//%path_to_target_node% is the path to the component's node in checkout_index_index.
The following sample is an example of the around method removing a component:
182
+
Once created, add the layout processor through Dependency Injection (DI).
160
183
161
-
```php?start_inline=1
162
-
unset($jsLayout['components']['checkout']['children']['steps'][%path_to_target_node%]); //%path_to_target_node% is the path to the component's node in checkout_index_index.xml
0 commit comments