This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 1 voice and has 0 replies.
>Author | Posts |
---|---|
December 21, 2023 at 2:20 pm #15111095 | |
anastasiaM |
//Filter on sale when language is french foreach ($query['meta_query'] as $index => $item) { // Get on-sale product IDs // If on-sale products are found // Filter products based on the wpml_language_code meta key for French // Set post__in to on-sale products // If no on-sale products, set post__in to an array with 0 return $query; |
December 21, 2023 at 2:57 pm #15111563 | |
anastasiaM |
add_filter( 'jet-smart-filters/query/final-query', function( $query ) { if ( ! isset( $query['meta_query'] ) ) { foreach ( $query['meta_query'] as $index => $item ) { if ( false !== strpos( $query['meta_query'][$index]['key'] ?? '', 'woo__on_sale' ) ) { unset( $query['meta_query'][ $index ] ); // Get on-sale product IDs // Check if it's a WPML environment // Translate on-sale product IDs to the current language // If no translated on-sale products, set post__in to an array with 0 // Set post__in to translated on-sale products if ( empty( $query['post__in'] ) ) { return $query; |