Automattic\WooCommerce\Blocks\Utils
CartCheckoutUtils::find_express_checkout_attributes()
Recursively search the checkout block to find the express checkout block and get the button style attributes
Method of the class: CartCheckoutUtils{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = CartCheckoutUtils::find_express_checkout_attributes( $blocks, $cart_or_checkout );
- $blocks(array) (required)
- Blocks to search.
- $cart_or_checkout(string) (required)
- The block type to check.
CartCheckoutUtils::find_express_checkout_attributes() CartCheckoutUtils::find express checkout attributes code WC 9.5.1
public static function find_express_checkout_attributes( $blocks, $cart_or_checkout ) { $express_block_name = 'woocommerce/' . $cart_or_checkout . '-express-payment-block'; foreach ( $blocks as $block ) { if ( ! empty( $block['blockName'] ) && $express_block_name === $block['blockName'] && ! empty( $block['attrs'] ) ) { return $block['attrs']; } if ( ! empty( $block['innerBlocks'] ) ) { $answer = self::find_express_checkout_attributes( $block['innerBlocks'], $cart_or_checkout ); if ( $answer ) { return $answer; } } } }