ResolvedAutomatic Cover image
Tagged: cover image, featured image, importing, refer theme
- This topic has 5 replies, 2 voices, and was last updated 3 years, 2 months ago by
Alex.
- AuthorPosts
- August 31, 2020 at 4:07 am #25424
mou
ParticipantHi!
I’m using Refer theme and I’d like to have the Product Cover Image automatically set.
I’m importing many products (thousands), and I saw your custom field refer_product_cover_image_id that needs the image id, not the URL, so I can’t get the image id before it is imported.
My workaround is making the Cover image as the same as the featured image for all products. I didn’t find any global option for cover image in your theme options and I’d like some help to make “product cover image = featured image if the image it’s not set”.
Thank you!
September 1, 2020 at 11:01 pm #25458Alex
KeymasterHi mou,
I understand, but this is really outside the theme scope.
What you need is a bit more configurable WordPress content import plugin. I am sorry, but am not able to point you to any particular. May be look at the most popular ones.Regards,
AlexSeptember 2, 2020 at 8:36 am #25465mou
ParticipantHi Alex!
Thanks for your reply.
I’m not sure if it’s an importation question. I’m aware that I can’t set the cover while importing because I don’t have an image ID before importing. I was just explaining, but what I need help is the workaround.I need to make the Cover image the same as the featured image for all products. What and where should I change to have the product cover image being loaded as the same as the featured image if no image is set? I can do it, I just need a little guidance.
Thanks,
September 2, 2020 at 11:55 am #25466Alex
KeymasterHi Mou,
It really depends how you are importing the products. If you are writing your own tool, then look at the WooCommerce developer documentation, i.e. update_meta_data() or add_meta_data() of the WC_Product class: https://woocommerce.github.io/code-reference/classes/WC-Data.html#method_add_meta_data
I any case refer_product_cover_image_id is just a product meta field and can be altered as any other meta field, so any resources for developing for WordPress and WooCommerce will apply also here.
Regards,
AlexSeptember 2, 2020 at 6:59 pm #25475mou
ParticipantHi Alex,
I’m sorry, I may not be clear enough. Please, forget the importation.
I just want to change the theme code in order to load the featured image in the cover image.
“$coverimage = $featuredimage” , just it.Thanks,
September 3, 2020 at 4:24 pm #25495Alex
KeymasterHi Mou,
Ok, you need to copy refer\woocommerce\content-single-product.php to the child theme and modify line 38 to:
<?php $refer_product_cover_img_id = $product->get_image_id(); ?>
Regards,
Alex - AuthorPosts
You must be logged in and have valid license to reply to this topic.