Skip Navigation

Open

Topic Tags: Compatibility, WCML

Overview of the issue

In setups with Germanized for WooCommerce and WPML, there’s an issue where shipping methods that utilize Shipping Classes conditions are not available for translated products.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open …/wp-content/plugins/woocommerce-germanized/packages/woocommerce-germanized-shipments/src/ShippingMethod/ShippingMethod.php file.
  • Look for line 957.
  • Replace:
    					$classes = isset( $condition['classes'] ) && ! empty( $condition['classes'] ) ? array_map( 'absint', (array) $condition['classes'] ) : array();
    
  • With:
    					$classes = isset( $condition['classes'] ) && ! empty( $condition['classes'] ) ? array_map( 'absint', (array) $condition['classes'] ) : array();
    					// compsupp-7583 workaround
    					// Assuming $classes is an array of category IDs.
    					$classes = array_map(function($class_id) {
    						// Translate each ID using WPML
    						return apply_filters('wpml_object_id', $class_id, 'category');
    					}, $classes);
    

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>