How to change the name of the default wishlist title

This task will require some changes to wishlist-view.php template
You can override it simply copying it from wp-content/plugins/yith-woocommerce-wishlist-premium/templates/wishlist-view.php to wp-content/themes/<your theme or child>/woocommerce/

Then, we'll have to change the followng lines:

  • line 27 from this
<div class="wishlist-title <?php echo ( $wishlist_meta['is_default'] != 1 && $is_user_owner ) ? 'wishlist-title-with-form' : ''?>">

to this

<div class="wishlist-title <?php echo ( $is_user_owner ) ? 'wishlist-title-with-form' : ''?>">
  • line 29 from this
<?php if( $wishlist_meta['is_default'] != 1 && $is_user_owner ): ?>

to this

<?php if( $is_user_owner ): ?>
  • line 36 from this
<?php if( $wishlist_meta['is_default'] != 1 && $is_user_owner ): ?>

to this

<?php if( $is_user_owner ): ?>
  • line 312 from this 
<?php if( $wishlist_meta['is_default'] != 1 ): ?>

to this

<?php if( true || $wishlist_meta['is_default'] != 1 ): ?>

Then, we'll need to add a couple of lines of code at the end of functions.php file of your theme

if( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwl_remove_default_title' ) ){
  function yith_wcwl_remove_default_title( $args, $action, $action_params ){
    if( isset( $args['wishlist_meta'] ) && $args['wishlist_meta']['is_default'] && ! empty( $args['wishlist_meta']['wishlist_name'] ) ){
      $args['page_title'] = $args['wishlist_meta']['wishlist_name'];
    }

    return $args;
  }
  add_filter( 'yith_wcwl_wishlist_params', 'yith_wcwl_remove_default_title', 10, 3 );
}

This should do the trick :)

Was this article helpful?
1 out of 1 found this helpful

Back to Help Center

Powered by Zendesk