Hi @lorilself,
Unfortunately it’s the theme developer’s responsibility to provide a fallback/default HTML code when there is no cart fragment information.
Hello,
Below is the reply I received from the theme developer, Brainstorm Force, when I notified them of your reply. Please advise, thanks.
“I would like to confirm that the conflict you are experiencing is due to the Disable Cart Fragments plugin. In this case, it is appropriate to reach out to the plugin developers responsible for resolving this issue.
It is important to note that third-party plugins often collaborate closely to ensure compatibility and address any conflicts that may arise. As such, the responsibility lies with the plugin developers to address and fix this particular issue.”
@lorilself again, I’m afraid it’s their responsibility to provide a fallback. I wish I could be more helpful but I think you’ll see from our perspective: WooCommerce’s “cart fragments” are things that’s generated via the theme’s code, and each theme has a way to generate those fragments. In order for the Disable Cart Fragments (DCF) plugin to be compatible with all themes, I would have to install every WordPress theme, see how each generates their cart fragments (if it does generate any) and create a giant, million-line long compatibility class to ensure DCF is compatible with all themes.
The (correct) alternative is for each theme to simply don’t assume cart fragments are available at all times and maybe write a small compatibility class for DCF. In fact, checking the source code of the Astra theme (I assume you’re using Brainstorm Force’s Astra, which is a killer theme that I own a lifetime license of), I see that Astra has 24 different compatibility classes for different plugins. DCF could be the 25th.
There is one possible solution, or rather a workaround: You could hide that cart dropdown if the cart is empty, using the following CSS code:
.widget_shopping_cart:has(.widget_shopping_cart_content:empty){display: none;}
The cross-browser coverage of the has()
selector isn’t perfect (around 90%) but it will get the job done with the most popular browsers.
Thank you for the reply, I’ll give your suggestion a try.
You’re welcome @lorilself! Thank you for your input too. If I ever find a one-size-fits-all solution for all themes’ compatibility, I will definitely write here again and ping you.