Automattic\WooCommerce\Blocks\BlockTypes
SavedForLater::render_ssr_move_to_cart
SSR-mode markup for the Move-to-cart action button. SFL-specific. Always emits the wrapper so iAPI can toggle hidden after hydration without swapping the row out. Starts hidden when the row isn't purchasable.
Method of the class: SavedForLater{}
No Hooks.
Returns
String.
Usage
// private - for code of main (parent) class only $result = $this->render_ssr_move_to_cart( $item ): string;
- $item(array) (required)
- .
SavedForLater::render_ssr_move_to_cart() SavedForLater::render ssr move to cart code WC 10.9.4
<?php
private function render_ssr_move_to_cart( array $item ): string {
$is_move_to_cart_hidden = empty( $item['is_purchasable'] );
ob_start();
?>
<div
class="wp-block-button wc-block-components-product-button"
data-wp-bind--hidden="state.isMoveToCartHidden"
<?php
if ( $is_move_to_cart_hidden ) {
echo 'hidden';
}
?>
>
<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.onClickMoveToCart"
data-wp-bind--disabled="state.isCurrentItemPending"
>
<?php echo esc_html( $this->get_move_to_cart_label() ); ?>
</button>
</div>
<?php
return (string) ob_get_clean();
}