• Resolved Josh Kohlbach

    (@jkohlbach)


    Hi team,

    I noticed you have function wpmenucart_menu_item()

    On the condition where it’s an empty cart you don’t have a filter available to filter the menu item content.

    I was able to use wpmenucart_menu_item_a filter for when there are items but this isn’t possible when its an empty cart as per line 569.

    Could you either add a filter there OR fix the issue I’m having which is that your <a> tag doesn’t have a href=”#”. This causes issues with SEO because its an unlinked anchor.

    Thanks
    Josh

    • This topic was modified 4 years, 3 months ago by Josh Kohlbach.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hello @jkohlbach

    You can set the cart to always display and use the filter and CSS to modify it as you want.

    Hope that helps!

    Thread Starter Josh Kohlbach

    (@jkohlbach)

    Cheers thanks Alex, would be great to have the permanent fix though in a future release if possible. Ideally, just add a href=”#” to the <a> tag would be great. Then I wouldn’t have to filter at all.

    Plugin Contributor Ewout

    (@pomegranate)

    Could you elaborate on the (pratical) SEO issues you are referring to? We used to have the href="#" in the link in the earlier versions of this plugin, but decided to remove it because it’s not an actual link. # will take you to the top of the page, which is not always desired behavior. From the HTML5 specs:

    If the a element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents.

    If the a element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element’s contents.

    Thread Starter Josh Kohlbach

    (@jkohlbach)

    Hey Ewout,

    Yeah, its kind of confusing when the spec says one thing and Google says another.

    While testing with Google’s new Core Web Vitals tool (which uses the open source Lighthouse engine also made by Google) they measure SEO as one of the metrics.

    Apparently having an anchor tag that doesn’t lead anywhere (ie. no href or empty href attribute) causes this to fail the rule.

    It’s not only restricted to your tool, I raised a similar one with Elementor about their Accordion element. They take the same approach using anchors for the titles.

    The reason I’m concerned on this is that they’ve announced page experience as measured by the tool will be used as a ranking signal in future.

    I’m happy if you want to keep it close to the spec, if that’s the case then a filter would be much appreciated for those of us who want to fix it.

    Thanks!
    Josh

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t filter menu item when empty cart’ is closed to new replies.