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])) :
?>
'. 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']) : ?>