get_gallery_image_ids(); $count = 0; foreach( $attachment_ids as $attachment_id ) { $count++; //make sure you're on the Shop Page and that you only get the first image if(is_shop() && $count <= 1) { if(!empty(wp_get_attachment_image_src( $attachment_id, 'woocommerce_thumbnail' )[0])) : ?> <?php echo esc_attr( get_the_title( $attachment_id ) ); ?> '. wp_kses_data( WC()->cart->get_cart_contents_count() ) .''; } /* --------------------------------------------------------- add to cart fragment ------------------------------------------------------------ */ add_filter( 'woocommerce_add_to_cart_fragments', 'tx_cart_icon_add_to_cart_fragment' ); function tx_cart_icon_add_to_cart_fragment( $fragments ) { ob_start(); tx_cart_icon_link(); $fragments['a.tx-cart'] = ob_get_clean(); return $fragments; } /* --------------------------------------------------------- cart icon ------------------------------------------------------------ */ if ( class_exists( 'WooCommerce' ) ) { add_action( 'tx_cart_icon', 'tx_cart_icon' ); function tx_cart_icon() { global $tx; if($tx['tx-cart']) : ?>
is_in_stock() ) { return $tx['woo-readmore-text'] ; } return $text; } /* --------------------------------------------------------- Change "Out of stock" text on single product ------------------------------------------------------------ */ add_filter( 'woocommerce_get_availability', 'tx_wc_out_of_stock_text', 1, 2); function tx_wc_out_of_stock_text( $availability, $_product ) { global $product; global $tx; if ( !$_product->is_in_stock() ) $availability['availability'] = $tx['woo-outofstock-text']; return $availability; } /* --------------------------------------------------------- EOF ------------------------------------------------------------ */