Astra_Woocommerce::modern_add_to_cart()
Modern Design Add to cart Markup
Description
Return
(mixed) HTML markup.
Source
File: inc/compatibility/woocommerce/class-astra-woocommerce.php
public function modern_add_to_cart() { global $product; $markup = ''; // 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 ); return $markup; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
3.9.2 | Introduced. |