How to paste 'buy' button below the product in woocommerce [closed]

-1

I'm doing an ecommerce with woocommerce for wordpress.

I would like to know how and in which file to put a "buy" button, where when clicking it it does not add to the cart, but rather direct the product page. (the theme does not have this option, so it has to be done in the hand

    
asked by anonymous 26.03.2015 / 03:01

2 answers

2

The woocommerce files related to the presentation of contents (templates) are in the

  

/ wp-content / plugins / woocommerce / templates /

In this folder you can see the base templates (among others):

  

archive-product.php - displays a list of products

     

single-product.php - details of a product

This single-product file will fetch the data from the / single-product folder ... it is in this folder that you can make changes to the product page ... still in this folder you can see the sub add-to-cart where you have the templates for the button.

How much to change the behavior of the button I do not know how it will be, but it is possible!

Another important thing , do not modify the files here, copy them to your theme folder so that it looks like this: ... / o_your_template / woocommerce / templates /. .. and then modify those files in your theme! If you modify them in the plugin folder you will run out of these modifications when updating woocommerce!

    
26.03.2015 / 23:32
0

To change the button link we will have to edit the functions.php file located in wordpress / wp-content / themes / "your theme in use" /

function custom_woocommerce_loop_add_to_cart_link( $html, $product ) {
return '<a href="LINK PARA PAGINA DE DESTINO" class="button">' . __( 'Comprar' ) . '</a>';
}
add_filter( 'woocommerce_loop_add_to_cart_link', 'custom_woocommerce_loop_add_to_cart_link', 10, 2 );

Open the file quoted above in your preferred text editor and copy this code. Change the "LINK TO DESTINATION PAGE" to the link of the page you want to redirect the button and save.

    
24.10.2015 / 14:39