Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions

GroupedProductItemSelector::get_button_markupprivateWC 1.0

Gets the add to cart button markup for a product.

Method of the class: GroupedProductItemSelector{}

No Hooks.

Returns

String. The HTML markup for the add to cart button.

Usage

// private - for code of main (parent) class only
$result = $this->get_button_markup( $product_to_render );
$product_to_render(WC_Product) (required)
The product object.

GroupedProductItemSelector::get_button_markup() code WC 10.8.1

private function get_button_markup( $product_to_render ) {
	ob_start();
	woocommerce_template_loop_add_to_cart();
	$button_html = ob_get_clean();

	return $button_html;
}