• Resolved vissersj

    (@vissersj)


    I have made a customization in wishlist-view.php and would like to have that customized file in my themes folder, so the plugin can be updated automatically. Unfortunately the script below (in functions.php) isn’t working and I am unable to get it right. Would you be so kind pointing me in the right direction? Many thanks!

    add_filter( 'wc_get_template', 'nav_override_wcwl_wishlistview_template', 20, 5 );
    function nav_override_wcwl_wishlistview_template( $located, $template_name, $args, $template_path, $default_path ) {

    if ( strpos( $template_name, 'wishlist-view.php' ) === false ) {
    return $located;
    }

    $theme_file = get_stylesheet_directory() . '/yith-woocommerce-wishlist/templates/wishlist-view.php';
    $theme_file = wp_normalize_path( $theme_file );

    if ( file_exists( $theme_file ) && is_readable( $theme_file ) ) {
    return $theme_file;
    }

    return $located;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello there,
    thanks for contacting us!

    The best way to do this is to use a child theme and place the templates there. This way, even if you update the plugin or your theme, the changes won’t be lost.

    Try it and let us know if you have any questions.

    Best regards.

    Thread Starter vissersj

    (@vissersj)

    Thanks for your reply Juan! Please see the paths I use below, is that correct? Should it be working automatically without any additional scripting?

    Path plugin: /wp-content/plugins/yith-woocommerce-wishlist/templates/wishlist-view.php
    Path theme: /wp-content/themes/mychildtheme/yith-woocommerce-wishlist/templates/wishlist-view.php

    Hello there,

    The correct path is the following:

    /wp-content/themes/mychildtheme/woocommerce/wishlist-view.php

    Could you check it, please?

    Best regards.

    Thread Starter vissersj

    (@vissersj)

    Yes it works, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.