So i'm setting up an external link products (affiliate), and i've been trying to remove add to cart from the website with no luck. I've tried many solutions, but none worked. Either they pop html 500, or they break a page, or simply don't work. Also plugins for that do not work. Is there any way i can get it done? Theme i'm using is Exzo: https://themeforest.net/item/modern-electronics-ecommerce-wordpress-woocommerce-theme-exzo/19356950
Solutions i tried:
// Replace add to cart button by a linked button to the product in Shop and archives pages
add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_loop_add_to_cart_button', 10, 2 );
function replace_loop_add_to_cart_button( $button, $product ) {
// Not needed for variable products
if( $product->is_type( 'variable' ) ) return $button;
// Button text here
$button_text = __( "View product", "woocommerce" );
return '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';
}
Then
add_filter( ‘woocommerce_is_purchasable’, false );
Also
function WpBlog() {
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’);
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’);
return WooCommerce::instance();
}
And woocommerce.php doesnt have over 900 lines needed for this one
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );