Monday, May 21, 2018

WooCommerce product image filename in product title

Leave a Comment

I recently started a WooCommerce project for a photographer client. I installed the commercial WooCommerce Photography extension and the Product Add-Ons extension. The client wants to add the product image title (filename) to the name of the product. Is there a way to do it somehow?

The WooCommerce Photography extension creates individual products from the photos you upload. Every product has one photo as a product image.

Basically, what I want to achieve is to show the filename of the main product image inside the name of the generated product. As long as I have it in the order details page, I am good. Anyone with a similar experience?

1 Answers

Answers 1

Ok. Based on what I have understood from your question, following might be the solution for your problem.

First get featured image url. Ref: How to get featured image of a product in woocommerce

Now use this URL to get filename. Ref: https://gist.github.com/wooki/2709106

Once you get filename, you can echo it wherever needed or you can use this all in single-product template or order-details template.

Hope this helps.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment