Automattic\WooCommerce\Blocks\BlockTypes
Wishlist::render_template_add_to_cart
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.
Метод класса: Wishlist{}
Хуков нет.
Возвращает
string.
Использование
// private - только в коде основоного (родительского) класса $result = $this->render_template_add_to_cart(): string;
Код Wishlist::render_template_add_to_cart() Wishlist::render template add to cart WC 11.3.0
<?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();
}