newbie hook question
-
Hello, I want to use a product for a plugin customization shop. There is a template error, I want to know where I have to add the recommended code :
++++++++++++++++++++++
woocommerce_before_add_to_cart_button hook is missing in the woocommerce templates of your theme. Help me fixing it.They ask me :
+++++++++++++++++++++++
Missing hook: woocommerce_before_add_to_cart_buttonThe add-to-cart templates does not include the required :
do_action( ‘woocommerce_before_add_to_cart_button’ );
Check out the standard templates in “plugins/woocommerce/templates/single-product/add-to-cart/”, to see how it is supposed to look.
<td class=”product-thumbnail”>
<?php
$thumbnail = apply_filters( ‘woocommerce_cart_item_thumbnail’, $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $_product->is_visible() )
echo $thumbnail;
else
printf( ‘%s‘, $_product->get_permalink(), $thumbnail );
?>
</td>+++++++++++++++++++++++
So I check this file :
plugins/woocommerce/templates/single-product/add-to-cart
Inside I have :
++++++++++++++++++++++++++++++
?>
<?php if ( $product->is_in_stock() ) : ?>
<?php do_action( ‘woocommerce_before_add_to_cart_form’ ); ?>
<form class=”cart” method=”post” enctype=’multipart/form-data’>
<?php do_action( ‘woocommerce_before_add_to_cart_button’ ); ?><?php
if ( ! $product->is_sold_individually() ) {
woocommerce_quantity_input( array(
‘min_value’ => apply_filters( ‘woocommerce_quantity_input_min’, 1, $product ),
‘max_value’ => apply_filters( ‘woocommerce_quantity_input_max’, $product->backorders_allowed() ? ” : $product->get_stock_quantity(), $product ),
‘input_value’ => ( isset( $_POST[‘quantity’] ) ? wc_stock_amount( $_POST[‘quantity’] ) : 1 )
) );
}
?><input type=”hidden” name=”add-to-cart” value=”<?php echo esc_attr( $product->id ); ?>” />
<button type=”submit” class=”single_add_to_cart_button button alt”><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
<?php do_action( ‘woocommerce_after_add_to_cart_button’ ); ?>
</form><?php do_action( ‘woocommerce_after_add_to_cart_form’ ); ?>
<?php endif; ?>
++++++++++++++++++++++++++++++++++
So where am I supposed to add the missing lines ?
Thanks.
The topic ‘newbie hook question’ is closed to new replies.