Sorry, but additional customizations of third party plugins are out of theme support scope. And we don’t have an instruction or tutorial that can help you in this situation.
This codes works perfectly for the width but it created another issue. It does not allow me to access any category page without being logged in. Meaning that if Im sighed in every category is available but if I log out it redirects me to the log in page. I will include a screenshot for you to check it out.
P.S I used the check out page redirect code and there was the same issue.
Please check the issue on one of the default themes to understand where our theme causes the problem. If you see the same situation on the default theme, deactivated all the third parties plugins not related to the theme and activate them one by one to discover which one influence. Also, remove all customization code if any.