You’ll need php for that… try this in your functions.php:
Detect if cart is empty and add class to body if is:
add_filter( 'body_class','my_custom_class' );
function my_custom_class( $classes ) {
if ( WC()->cart->get_cart_contents_count() == 0 ) {
$classes[] = 'my-emptycart-class';
}
return $classes;
}
Now you can use .my-emptycart-class in your CSS.
Related Posts:
- How to get current product category ID in product archive page
- WooCommerce prices location in DB
- WP/WooCommerce REST API cart/checkout/order [closed]
- Fatal Error when installing woocommerce despite upgrading
- Adding an action within a function that is being called by add_filter
- Hide Add to Cart Button
- How to modify “[Product] has been added to your cart” in WooCommerce?
- woocommerce fail to replace template string in email title [closed]
- Why do Woocommerce templates use hooks rather than get_template_part
- Woocommerce checkout via external page [closed]
- Change font size in products listing pages in woocommerce
- How to stop a Gutenberg Block from firing multiple GET Requests?
- Trying to disable slider for WooCommerce price filter [closed]
- Hide “Delete Note” link in Order Notes Panel
- Exclude products with a stock lower than the low stock threshold from the shop loop [closed]
- Woocommerce reviews xss issue [closed]
- Unable to update Woocommerce Product Permalink
- wp_customize – detect post type to show/hide customizer options
- WooCommerce – Display nested list of all subcategories on archive-product.php
- Creating Product Table using Gutenberg
- I can ‘t display product images based on the label
- SKU for each product on every page
- Woocommerce get billing state manually
- WooCommerce quick checkout form? [closed]
- woocommerce cart item remove ajax not working in hosted site [closed]
- Set woocommerce product price based on dealer location [closed]
- How can I custom order the product display?
- WordPress plugin cloak link [closed]
- Woocommerce REST API – updating an order changes custom tax calculations
- How to list all WC products by their attributes values?
- Showing the WordPress standard text area on a Woocommerce Single Product Page?
- Woocommerce Update Causing Internal Server Error [closed]
- WordPress WooCommerce: How to allow only specified customers to pay by check? [closed]
- remove default pagination on woocommerce shop page
- WordPress Comment Box on woocommerce product page [closed]
- Remove Bulk Action For non admin user
- Add max-value to hooked quantity selector in woocommerce [closed]
- Can’t remove woocommerce sidebar
- Woocommerce Slow Queries
- woo product , wp_insert_post() never displays on the front end. What gives? [closed]
- Disabling shopping basket in WooCommerce [closed]
- Single product page doesn’t display price
- Should I use docker in wordpress production?
- How to output woocommerce products to a page, style and modify the html structure
- Else: Show Message Outside of Product Loop
- Clients with empty username are not receiving request new password email
- Variation Swatches for WooCommerce – too many variations
- How to make an edit to an already published post back to Draft
- Display data when category is empty
- Disable woocommerce PLACE ORDER button if user selected products that are not available for international delivery
- Images not uploading on product page of woocommercr
- How to access WC()->cart in CF7 hook wpcf7_special_mail_tags
- How to integrate e-transfers with checkout in WooCommerce
- Manual Admin Orders search for billing_company
- Use woocmmerce function on theme and override them
- Send all emails to Shop Manager along with admin
- Snippet to copy product affiliate link to a custom field
- Woocommerce Checkout Page Total Price Inside Google Pay Script
- How to hide order action button after changing order status to completed
- How to get rid of variations with unspecified attributes
- Deregister dequeue JS scripts except on 1 product page
- Registration roles
- Change password notification email
- How to show price update date in product single page?
- Woocommerce Rest API: woocommerce_product_invalid_image_id
- How do I disable “Flat Rate” radio button and remain with other shipping method in woocommerce
- How to add woocommerce product price filter widget to other page
- how can my customers view their purchased products history like an invoice in a specific page on WordPress
- How do I make my products on the homepage responsive?
- How to get users data from wordpress woocomerce database to display
- Simple thing esc_url query
- Woocommerce on Subdirectory
- Change WooCommerce state and city checkout fields to dropdowns related to the chosen country
- How to apply a custom coupon to a WooCommerce Subscription recurring amount?
- How to send an automatic email to a custom field in Woocommerce order meta 2 weeks after a product is bought
- How to customize product at cart page
- WooCommerce Storefront site-header padding
- WooCommerce: How can I add a certain product to the cart and redirect to the cart from a non-shop page?
- Make Woocommerce breadcrumbs show up using functions.php file
- Alter the cost of products using phpmyadmin sql query
- How does one allow any customer to process any order in store on woocommerce?
- WooCommerce CSV Image URL Creates Additional Images in Media Folder
- Update products with curl (bash)
- Create woocommerce order on new user registration
- How to put a date range in a virtual/downloadable product? [closed]
- Woocommerce Child Category Permalink Structure Change
- Allow customer to choose an optional free/paid product to add to their order (and reduce stock reduced & record sale)
- How to restrict type/size of file uploads in any plugin?
- In woocommerce some products have empty options, but how to check this
- Stop the “upload file size” error from printing [closed]
- Redirect whole website or pages to /wp-admin in wordpress
- Changing sale price programmatically, but it’s not shown on front-end
- How to disable the “Upgrade or Downgrade” button in “My account” of WooCommerce Subscriptions
- WooCommerce – Inconsistent Indexing of Orders
- How to remove slug from Product category URL in Woocommerce
- Removing ‘woocommerce-no-js’ class from body
- url rewrite doesn’t load woocommerce product
- Critical error on woocommerce checkout page
- Can’t add variable products since update WooCommerce [closed]
- Add custom ID to WooCommerce product tab