• Resolved nopewhy

    (@nopewhy)


    Hello everyone.

    When I place a product in the shopping cart (in a standard storefront woocommerce), a new button will appear right next to the “add to cart” button. The new button is labeled “view cart”
    Example
    Unfortunately this button stays put, even if I delete said item from the cart (in a new tab, via the shopping basket in the nav area, etc.) so that the cart is empty again.
    Is there an easy way that I’ve overlooked so far, to get the button to disappear when the cart is empty?
    I surely could display:none; the whole button all the time, but I only want it gone when there’s no reason to access the cart because it’s empty.

    I’m unfortunately rather team copy/paste when it comes to php and editing the child’s functions.php or writing plugins and had no luck googling so far.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Yuki K a11n.

    (@yukikatayama)

    Automattic Happiness Engineer

    Hey @nopewhy,

    After the cart is emptied, do you refresh the page to see if the “View Cart” button disappears? You would still need to do that after cart gets emptied.

    If the button still shows even after refreshing, I’d rule out a theme or with another plugin. The best way to determine if the issue is being caused by a theme and/or plugin is to:

    1. Temporarily switch your theme to the Storefront (https://woocommerce.com/products/storefront/) or TwentySeventeen (https://wordpress.org/themes/twentyseventeen/) theme.
    2. Try to reproduce the problem. If the problem is resolved, it is a theme conflict. If not, continue to the next step.
    3. Temporarily deactivate all plugins except WooCommerce. You can do this manually or use Meks Quick Plugin Disabler (https-//wordpress.org/plugins/meks-quick-plugin-disabler/).
    4. Try to reproduce the problem again. If the problem is resolved, it is a plugin conflict.
    5. Reactivate each plugin one by one, testing after each, until you find the one causing conflict. That will be the culprit and contacting the developers/support team of that plugin is recommended.

    If you do not want to interrupt your live site during testing, you can clone your site to a staging environment and perform tests without modifying your live site or impacting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging (https-//wordpress.org/plugins/wp-staging/) plugin.

    As always, backing up your live site before any testing and updates is highly recommended.

    Hope that helps!

    Thread Starter nopewhy

    (@nopewhy)

    Hello @yukikatayama,

    thank you for your detailed reply.
    I fear that I communicated what I am looking for poorly.
    There is no problem/bug in the button behavior itself. It behaves completely normally for a woocommerce, exactly the same as the demo (https://themes.woocommerce.com/storefront/). When I refresh the page, the button is gone.
    What I am actually looking for is a way to have the button disappear as soon as the cart is emptied (for example by using the cart preview in the header, where one can delete items from the cart), even if I don’t refresh the page.

    So my question is: Is this possible, and if yes then how?

    Plugin Support Yuki K a11n.

    (@yukikatayama)

    Automattic Happiness Engineer

    Hi @nopewhy,

    By default, page would need to be refreshed to remove the View Cart button. With some custom coding, it might be possible to trigger the removal after product is removed from the header cart drop down.

    I personally don’t know what custom coding would help in this case, but if you need assistance with coding, we recommend contacting a developer from one of these services at https://woocommerce.com/customizations/.

    Cheers,
    Yuki

    Stephen

    (@idiots_guide)

    Thread Starter nopewhy

    (@nopewhy)

    @idiots_guide Thank you, Stephen!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide “view cart” button if cart is empty’ is closed to new replies.