Automattic\WooCommerce\Blocks\BlockTypes

Wishlist::render_template_add_to_cartprivateWC 1.0

Template-mode markup for the "Add to cart" action button. iAPI substitutes the per-row state through data-wp-bind--hidden and data-wp-bind--disabled.

Method of the class: Wishlist{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->render_template_add_to_cart(): string;

Wishlist::render_template_add_to_cart() code WC 10.9.1

<?php
private function render_template_add_to_cart(): string {
	ob_start();
	?>
	<div class="wp-block-button wc-block-components-product-button" data-wp-bind--hidden="state.isAddToCartHidden">
		<button
			type="button"
			class="wp-block-button__link wp-element-button add_to_cart_button wc-block-components-product-button__button"
			data-wp-on--click="actions.onClickAddToCart"
			data-wp-bind--disabled="state.isCurrentItemPending"
		>
			<?php echo esc_html( $this->get_add_to_cart_label() ); ?>
		</button>
	</div>
	<?php
	return (string) ob_get_clean();
}