Skip Navigation

Resolved by author

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);