Phew!
Here is the code for functions.php.
add_filter( 'woocommerce_single_product_image_thumbnail_html', 'change_alt_to_caption_gallery_images', 10, 2 );
function change_alt_to_caption_gallery_images ( $wc_get_gallery_image_html, $image_id ){
$caption = get_post_field( 'post_excerpt', $image_id );
if ( !empty($caption) && !empty($wc_get_gallery_image_html) ) {
$caption = str_replace( '"', "''", $caption );
$caption_repl="data-caption="" . $caption . '"';
$wc_get_gallery_image_html = preg_replace( '/data-thumb-alt="[^"]+"/', $caption_repl, $wc_get_gallery_image_html );
}
return $wc_get_gallery_image_html;
}
Related Posts:
- WooCommerce single products images doesn’t zoom on hover and doesn’t change clicking on gallery
- woocommerce image product add a class and data-src attributes
- Image is not displayed in overridden woocommerce email
- WordPress Twenty Seventeen header image size not responsive for mobile
- How to upload images from wordpress front-end (the first image must be thumbnail and the rest without first must be in gallery woocommerce product)
- How to delete 1000s of duplicated images in WordPress?
- Some images aren’t shown on wordpress after installation on host
- Add custom CSS class to product images
- Woocommerce product image [closed]
- How do I make the product image smaller on a WooCommerce product page?
- Updating product image
- Images not uploading on product page of woocommercr
- How to solve `Error getting remote image` in woocommerce rest api script?
- Images not showing on site – Even though they are there
- Delete product image using WooCommerce API?
- Set Post Thumbnail to external URL
- Correct method of reducing the number of images created by WP and Woo together
- How do I change the woocommerce product gallery to show all thumbnails instead of three at a time in a carousel?
- How to show image caption in Woocommerce gallery
- Titles with thumbnails in media library
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)
- Blurry product card image – rendered is 486×452 vs 300×279 in real image. Smaller versions being autocreated and served using srcset
- Export Woocomerce Image Product URL
- Thumbnail appearing small, not reflecting what is set in elementor
- How do I get my image for my product to not be blurry
- How to get current product category ID in product archive page
- WooCommerce prices location in DB
- Why do Woocommerce templates use hooks rather than get_template_part
- Display WooCommerce only in stock sizes product attribute on shop page
- Remove “Choose An Option” on Product Variation & Auto Select Instead
- check if current url/page equals checkout page [closed]
- How to stop a Gutenberg Block from firing multiple GET Requests?
- Woocommerce Product Price Inserted programmatically doesn’t get displayed In Single Product Page
- How to Order by random on a SQL query
- Move add to cart in Woocommerce
- Hide “Delete Note” link in Order Notes Panel
- Exclude products with a stock lower than the low stock threshold from the shop loop [closed]
- Remove Order List Row Link in WooCommerce Admin?
- wp_customize – detect post type to show/hide customizer options
- WooCommerce – Display nested list of all subcategories on archive-product.php
- Woocommerce REST API – updating an order changes custom tax calculations
- How to list all WC products by their attributes values?
- Showing the WordPress standard text area on a Woocommerce Single Product Page?
- WordPress WooCommerce: How to allow only specified customers to pay by check? [closed]
- Make a Read More toggle in the_content on single-product in Woocoomerce
- WooCommerce Base Page Featured Image Custom Theme
- WordPress Comment Box on woocommerce product page [closed]
- Can’t remove woocommerce sidebar
- Woocommerce Slow Queries
- How to display the percentage of the applied tax in woocommerce [closed]
- Disabling shopping basket in WooCommerce [closed]
- Should I use docker in wordpress production?
- Dynamic Product Variation in WooCommerce
- can’t get the product id in single woocommerce page
- Php echo woocommerce price
- Different files for order details
- Multiple Schema.org markups on a single product page
- Woocommerce – Adding row to cart table
- Hide a product with a certain tag from product-category
- Custom rewrite for product variation not working
- Block Disposable Emails on Woocommerce Registration
- Can’t Change WooCommerce Default Language to Spanish (Mexico)
- Adding of custom cart item data via Ajax Add to Cart
- Woocommerce – Display stock quantity per variation
- WooCommerce show a variation both in check boxes and in a list
- How can i get the code of Shop Page Woocommerce?
- “Products” Title changed
- Add shortcode to show woocommerce shipping class name on product template
- pass a woocommerce product name to contact form7?
- Custom Tab in Coupons causes “the link you followed has expired” error
- Search doesn’t return anything
- How to add (and change the font of) the short product description to order page and customer’s new order e-mail [closed]
- Using built-in validation pop-up for custom fields
- Get unsolved array keys of product data tabs in woo product editor page
- set up existent product blocked in woocommerce
- WordPress/Woocommerce Classes and adding new properties
- Customize categroy catalog page
- Create post when new woocommerce order is created [closed]
- email address non required
- How to get selected variation for a product in WooCommerce Cart Page?
- WooCommerce custom checkbox $_POST issue on checkout
- Removing storefront-sorting div from the before section of Shop page
- (WooCommerce) Conflict with template – Can’t load payment methods
- Hook woocommerce price in backend order edition
- How to programatically create a WooCommerce downloadable product?
- Custom sender email address for specific WooCommerce product
- Stock QTY gets negative after order
- Woocommerce REST API authentication with server password [closed]
- Change WooCommerce registration form/way?
- Membership website with discount on scheduled appointment
- Woocommerce: how to make only certain products shippable?
- Set single product image (main image) and archive thumbnail image as different from each other in Woocommerce
- WooCommerce Simple Auction and delayed capture
- ACF Create Array of All Woocommerce Product IDs with a Checkbox ticked
- How to display customer email within the meta order data box
- Bulk delete ‘Global Attributes’ in WooCommerce via WP-CLI?
- Checkout page not loading on my ecommerce website
- WooCommerce: expiring date for products (and on sale some days before)
- How to display woo commerce shipping_method on the product page
- Product Variation Auto Select when only one 1 and mark the option [closed]