Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions

AddToCartWithOptions::set_is_descendant_of_add_to_cart_with_options_contextpublicWC 1.0

Modifies the block context for product button blocks when inside the Add to Cart + Options block.

Method of the class: AddToCartWithOptions{}

No Hooks.

Returns

Array. Modified block context.

Usage

$AddToCartWithOptions = new AddToCartWithOptions();
$AddToCartWithOptions->set_is_descendant_of_add_to_cart_with_options_context( $context, $block );
$context(array) (required)
The block context.
$block(array) (required)
The parsed block.

AddToCartWithOptions::set_is_descendant_of_add_to_cart_with_options_context() code WC 10.7.0

public function set_is_descendant_of_add_to_cart_with_options_context( $context, $block ) {
	if ( 'woocommerce/product-button' === $block['blockName'] ) {
		$context['woocommerce/isDescendantOfAddToCartWithOptions'] = true;
	}

	return $context;
}