ResolvedAutomatic Cover image

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #25424
    mou
    Participant

    Hi!

    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!

    #25458
    Alex
    Keymaster

    Hi 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,
    Alex

    #25465
    mou
    Participant

    Hi 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,

    #25466
    Alex
    Keymaster

    Hi 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,
    Alex

    #25475
    mou
    Participant

    Hi 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,

    #25495
    Alex
    Keymaster

    Hi 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

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in and have valid license to reply to this topic.

License required for any item belonging to this account
AlThemist

AlThemist

sales 18045, followers 753
Login and Registration Log in · Register