Skip Navigation

Waiting for author

Topic Tags: Compatibility

Overview of the issue

When using Soho Hotel theme with WPML, the Season Price applied to an Accommodation in the default language is not copied to the translated Accommodation.

Workaround

As a workaround to fix this issue, please follow these steps:

  1. Go to WPMLSettingsCustom Field Translation and set the custom field shb_pricing to Copy.
  2. Add this code snippet in the theme’s functions.php file:
     
    add_action( 'wpml_after_copy_custom_field', function($post_id_from, $post_id_to, $meta_key){
        if ($meta_key == 'shb_pricing') {
            $translated_lang = apply_filters( 'wpml_post_language_details', '', $post_id_to );
            $translated_lang = isset($translated_lang['language_code']) ? $translated_lang['language_code'] : ''; 
            
    	$original_value = get_post_meta($post_id_from, 'shb_pricing', true);
    	$translated_value = $original_value;
    	
    	if (!empty($original_value) && is_array($original_value)) {
    	    foreach ($original_value as $key => $value) {
    		$session_id = intval(substr($key, 7));
    		if ( !empty($session_id) ) {
    		    $session_id = apply_filters( 'wpml_object_id', $session_id, 'shb_season', false, $translated_lang );
    		    $translated_value['season_' . $session_id] = $translated_value[$key];
    		    unset($translated_value[$key]);
    		}
    	    }
    	    
    	    update_post_meta($post_id_to, 'shb_pricing', $translated_value);
    	}
        }
    }, 10, 3);
    
  3. Update the original Accommodation and its translation.

Next steps to resolve this issue

The author of Soho Hotel will need to resolve this issue on their end as it is related to how the theme is coded. We have reached out a number of times, but we have yet to receive cooperation from the author.

If you’re experiencing this issue and you’d like to encourage the author to resolve it, please contact them on their private support forum.

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>