//Setting up Woocommerce "Add to Cart" button and adding an additional button for more info. //Add More Info button and changes it's text to the "Info" Icon. add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 20 ); add_action( 'woocommerce_after_shop_loop_item', 'sj_view_product_button', 10 ); function sj_view_product_button() { global $product; $link = $product->get_permalink(); echo 'r'; } //Change the Add to Cart text to basket Icon add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' ); function woocommerce_custom_product_add_to_cart_text() { return __( '', 'woocommerce' ); } //Changes basked icon to tick when product is already in the cart function change_button_text( $product_id, $button_text ) { foreach( WC()->cart->get_cart() as $item ) { if( $product_id === $item['product_id'] ) { return __('N', 'woocommerce'); } } return $button_text; } add_filter( 'woocommerce_product_add_to_cart_text', 'change_ajax_add_to_cart_button_text', 10, 2 ); function change_ajax_add_to_cart_button_text( $button_text, $product ) { if ( $product->is_type('simple') ) { $button_text = change_button_text( $product->get_id(), $button_text ); } return $button_text; }