Not working: Changing “add to cart” to “view product” on archive page
-
Hello folks,
I can’t change the “add to cart” buttons in the archive page (homepage) to “view product” buttons. The shop page just works fine.
add_filter( 'woocommerce_loop_add_to_cart_link', 'pg_replace_add_to_cart_button', 10, 2 ); function pg_replace_add_to_cart_button( $button, $product ) { if (is_home() || is_product_category() || is_shop()) { $button_text = __("View Product", "woocommerce"); $button_link = $product->get_permalink(); $button = '<a href="' . $button_link . '" class="button product_type_simple add_to_cart_button ajax_add_to_cart">' . $button_text . '</a>'; return $button; } }
What could be the reason for that?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Not working: Changing “add to cart” to “view product” on archive page’ is closed to new replies.