if ( ! function_exists( 'awooc_html_custom_add_to_cart' ) ) {
/**
* Displaying the button add to card in product page
*
* @param array $args массив параметров.
* @param null $product объект продукта.
*
* @since 1.5.0
* @since 2.1.4
*/
function awooc_html_custom_add_to_cart( $args = array(), $product = null ) {
if ( is_null( $product ) ) {
$product = $GLOBALS['product'];
}
$defaults = array(
'href' => '',
'product_id' => $product->get_id(),
'class' => apply_filters( 'awooc_classes_button', implode( ' ', awooc_mode_classes( $product ) ) ),
'id' => apply_filters( 'awooc_id_button', 'awooc-custom-order-button' ),
'label' => apply_filters( 'awooc_button_label', get_option( 'woocommerce_awooc_title_button' ) ),
);
$args = apply_filters( 'awooc_button_args', wp_parse_args( $args, $defaults ), $product );
ob_start();
do_action( 'awooc_before_button' );
?>
<a
href="<?php echo esc_url( $args['href'] ); ?>"
data-value-product-id="<?php echo esc_attr( $args['product_id'] ); ?>"
class="<?php echo esc_attr( $args['class'] ); ?>"
id="<?php echo esc_attr( $args['id'] ); ?>"
<?php do_action( 'awooc_attributes_button' ); ?>>
<?php echo esc_html( trim( $args['label'] ) ); ?>
</a>
<?php
do_action( 'awooc_after_button' );
echo ob_get_clean();//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}