ASTRA_Ext_WooCommerce_Markup::add_modern_triggers_on_image()
Modern shop page’s triggers on product image.
Description
Source
File: addons/woocommerce/classes/class-astra-ext-woocommerce-markup.php
public function add_modern_triggers_on_image() {
global $product;
$markup = '';
$product_id = $product->get_id();
// Sale bubble markup.
$sale_notification = astra_get_option( 'product-sale-notification', '', 'default' );
if ( $product->is_on_sale() && 'none' !== $sale_notification ) {
$markup .= $this->get_sale_flash_markup( $sale_notification, $product );
}
// Product link markup.
$header_woo_cart = astra_get_option( 'woo-header-cart-icon', 'default' );
$cart_icon = ( true === Astra_Icons::is_svg_icons() ) ? Astra_Icons::get_icons( 'default' === $header_woo_cart ? 'bag' : $header_woo_cart ) : Astra_Builder_UI_Controller::fetch_svg_icon( 'shopping-' . $header_woo_cart, false );
$classes = implode(
' ',
array_filter(
array(
'ast-on-card-button',
'ast-select-options-trigger',
'product_type_' . $product->get_type(),
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
$product->supports( 'ajax_add_to_cart' ) && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '',
)
)
);
$attributes = array(
'data-product_id' => $product->get_id(),
'data-product_sku' => $product->get_sku(),
'aria-label' => $product->add_to_cart_description(),
'rel' => 'nofollow',
);
$markup .= sprintf(
'<a href="%s" data-quantity="%s" class="%s" %s> <span class="ast-card-action-tooltip"> %s </span> <span class="ahfb-svg-iconset"> %s </span> </a>',
esc_url( $product->add_to_cart_url() ),
esc_attr( 1 ),
esc_attr( $classes ),
wc_implode_html_attributes( $attributes ),
esc_html( $product->add_to_cart_text() ),
$cart_icon
);
// Quick view markup.
$qv_enable = astra_get_option( 'shop-quick-view-enable' );
if ( 'disabled' !== $qv_enable && 'on-image' === $qv_enable ) {
$quick_view_button_text = apply_filters( 'astra_addon_product_card_quick_view_text', __( 'Quick View', 'astra-addon' ) );
add_filter( 'astra_theme_js_localize', array( $this, 'qv_js_localize' ) );
$markup .= '<span class="ast-on-card-button ast-quick-view-trigger" data-product_id="' . esc_attr( $product_id ) . '"> <span class="ast-card-action-tooltip">' . esc_attr( $quick_view_button_text ) . '</span>' . Astra_Builder_UI_Controller::fetch_svg_icon( 'eye', false ) . '</span>';
// load modal template.
add_action( 'wp_footer', array( $this, 'quick_view_html' ) );
}
$html = apply_filters( 'astra_addon_shop_cards_buttons_html', $markup, $product );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |