M
M
mipfikus2020-05-31 17:22:01
WordPress
mipfikus, 2020-05-31 17:22:01

How to change button links in WooCommerce?

It is necessary to change the link to the product link on the "Add to cart" buttons in the catalog, and the text to the details, but so that the "Add to cart" button in the product card does not lose its properties.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2020-05-31
@mipfikus

So you need to hide the "Add to Cart" button in the catalog using hooks.
Next, instead of it, add another button with the name "More" and display permalink as a link and that's it.
Hide cart - https://stackoverflow.com/questions/26976296/hide-...

add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );

    function remove_add_to_cart_buttons() {
      if( is_product_category() || is_shop()) { 
        remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
      }
    }

And here, here is information on how to replace a button with a custom button -
https://stackoverflow.com/questions/43914659/repla...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question