woocommerce_before_add_to_cart_form

woocommerce_before_add_to_cart_form

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: action

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

do_action('woocommerce_before_add_to_cart_form') is found 4 times:

  • /templates/single-product/add-to-cart/external.php line 20
     */
    
    defined( 'ABSPATH' ) || exit;
    
    do_action( 'woocommerce_before_add_to_cart_form' ); ?>
    
    <form class="cart" action="<?php echo esc_url( $product_url ); ?>" method="get">
    	<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
    
    	<button type="submit" class="single_add_to_cart_button button alt<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php echo esc_html( $button_text ); ?></button>
    
    
  • /templates/single-product/add-to-cart/grouped.php line 22

    defined( ‘ABSPATH’ ) || exit;

    global $product, $post;

    do_action( ‘woocommerce_before_add_to_cart_form’ ); ?>

  • /templates/single-product/add-to-cart/simple.php line 30

    echo wc_get_stock_html( $product ); // WPCS: XSS ok.

    if ( $product->is_in_stock() ) : ?>

    Share this:

  • /templates/single-product/add-to-cart/variable.php line 26
    $attribute_keys  = array_keys( $attributes );
    $variations_json = wp_json_encode( $available_variations );
    $variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true );
    
    do_action( 'woocommerce_before_add_to_cart_form' ); ?>
    
    <form class="variations_form cart" action="<?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product->get_permalink() ) ); ?>" method="post" enctype='multipart/form-data' data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>">
    	<?php do_action( 'woocommerce_before_variations_form' ); ?>
    
    	<?php if ( empty( $available_variations ) && false !== $available_variations ) : ?>
    		<p class="stock out-of-stock"><?php echo esc_html( apply_filters( 'woocommerce_out_of_stock_message', __( 'This product is currently out of stock and unavailable.', 'woocommerce' ) ) ); ?></p>