WC_Structured_Data Class Causing Needless Translation

You can change the line number 103 in the file /weglot/vendor/weglot/weglot-php/src/Parser/Check/RegexCheckerProvider.php original code : /* Add JSON LD checker */ $this->addChecker(new RegexChecker(“#<script type=(‘|\”)application\/ld\+json(‘|\”)([^\>]+?)?>(.*?)<\/script>#s” , SourceType::SOURCE_JSON, 4 , array( “description” , “name” , “headline” , “articleSection” ))); To replace by : /* Add JSON LD checker */ $this->addChecker(new RegexChecker(“#<script type=(‘|\”)application\/ld\+json(‘|\”)([^\>]+?)?>(.*?)<\/script>#s” , SourceType::SOURCE_JSON, 4 , array( “description” … Read more

No Results in WooCommerce Product Search

I got this solution from https://stackoverflow.com/a/57218305/900557 Add this to your theme’s functions.php The Answer from Chandrakant Devani helped, but broke other searches in the admin. Adding an if seems to avoid breakages if ( is_admin() && $query->is_main_query() && $query->query_vars[‘post_type’] == ‘product’) full code: add_action( ‘pre_get_posts’, ‘products_pre_get_posts’ ); function products_pre_get_posts( WP_Query $query ) { if ( … Read more

Woocommerce product query not working in other WPML languages

I would do two things Check if you get inside the IF-statement in the other languages. is_page(‘shop’) refers to a specific post/page ID. You can bypass this problem by fetching the current’s language translation post-ID with is_page( apply_filters( ‘wpml_object_id’, {{orig_page_id}}, ‘page’, true ) ) I would reverse the query, instead of excluding the unneeded product … Read more

Woocommerce redirection product_name -> product_cat/product_name

You could try the template_redirect action. Check if current request is a single product. @see https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect add_action( ‘template_redirect’, function() { //= bail early if( !is_404() ) return; //= get product name from url $product_name = get_query_var( ‘pagename’ ); //= bail if( empty( $product_name ) ) return; //= lookup product by name $product = get_page_by_path( $product_name, … Read more