1

How should I show the shop instead of a 404 page when a product is missing? Currently users get a 404 page which makes them loose interest.

I use woocommerce with wordpress on a server with nginx.

1

// Missing product redirect to product category add_filter( 'rewrite_rules_array', function( $rules ) { $new_rules = array( 'shop/([^/]*?)/page/([0-9]{1,})/?$' => 'index.php?product_cat=$matches[1]&paged=$matches[2]', 'shop/([^/]*?)/?$' => 'index.php?product_cat=$matches[1]', ); return $new_rules + $rules; } );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.