NoMethodError in Web#web_subcategory

Showing /var/www/vhosts/shopcandela.com/candela/app/views/web/web_subcategory.html.erb where line #31 raised:

undefined method `category' for nil:NilClass

Extracted source (around line #31):

28
29
30
31
32
33
34
          
<% end %>
<% end %>
],
item_list_id: <%= @products.first.category.id %>,
item_list_name: "<%= @products.first.category.name %>",
currency: "EUR",
},

Rails.root: /var/www/vhosts/shopcandela.com/candela

Application Trace | Framework Trace | Full Trace
app/views/web/web_subcategory.html.erb:31:in `_app_views_web_web_subcategory_html_erb___2049519400459815646_47184121767200'

Request

Parameters:

{"id"=>"21-zapatillas-hombre"}

Response

Headers:

None