Here is an example code snippet for creating a custom gallery slider for WooCommerce products: In this example, we are using the woocommerce_product_thumbnails action hook to add a custom gallery slider to the product page. We are using the Owl Carousel jQuery plugin to create the slider and enqueueing its required CSS and JS files.…
Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Scripts organizer plugin. Avoid adding custom code directly to your parent theme’s functions.php file, as this will be wiped entirely when you update the theme.
According to Medium, people read about 200 words per minute. Medium also adds 12 seconds for each inline image, but I didn’t get that fancy. Use Scripts Organizer to add this code. Set it as “Everywhere” since that is same as functions.php After you register a function call it in code block Result Article found…
Just a simple function that will hide products that have price set to 0. I found it useful when I was importing products from some external source where client decided to add prices manually. In case that there is no price set to 0, where price is empty this snippet could be used.
Add the following PHP code snippet in your favorite code manager plugin like Scripts organizer and set it to load on front end
Another little Woo Commerce polish to make your store look even more customised
This is a quality of life improvement for an ecommerce store.
Credit: https://businessbloomer.com/ for this one. Check out his website, he has hundreds of useful Woo snippets. When talking about UX, or for very specific WooCommerce shops, you might need to tell the user a product is already in the Cart before re-adding it or increasing its quantity from the Shop/Category/Loop and Single Product pages. This…
If you set up a one page checkout on oxygen or have a sidecart, you don’t want to see this pop up, as people may click it and go to the cart page (which you want to skip altogether), this hides that pop up.
Credit: https://businessbloomer.com/ for this one. Check out his website, he has hundreds of useful Woo snippets. This is useful so that your customer only sees your current stock.
Sometimes the zoom feature is useful, but it can also be very jarring to your customers. I prefer to have this off on every site and use a light box instead.
1st Step Install and activate Code Snippets plugin. Add below code in code snippets: 2nd Step Edit the Oxygen Template that applies to woo single products. For the element you want to apply the “minimum 1 upsell” condition, click on Conditions icon then Set Conditions. Click “Add Condition” icon. Choose Dynamic Data condition. Under Advanced click PHP Function Return value. Function Name: wpl_check_upsell_product…
With this example you can easily add cart count or total price anywhere on your webshop. This code uses woocommerce add to chart hook that is executed every time when you put something into basket. You just need to add this code anywhere where you wish to show total price. And this snippet will execute…
If you are using SlimSeo plugin it automatically add all posts and taxonomies into sitemap.xml file. This snippet allows you to exclude some post types and taxonomies from sitemap file. In this snippet above from sitemaps file will exclude ‘help’ and ‘slider’ post type, and ‘category’ taxonomy.
Here is a way to add WooCommerce cart icon to a menu with the cart item count, it links to the cart page and displays the number of items that have been added to the cart.The code uses three functions which need to be added to Snippet plugin. Create a shortcode for the WooCommerce cart,…
For retrieving the best buying products in WooCommerce we are using wp_query manipulation with meta_key as “total_sales” and orderby “meta_value_num”. In short we are displaying products as per the total sales number. Here is Screenshot for repeater / easy posts Step 1 – Select Advance WP Query Step 2 – Setup Advance WP Query as…
Sometimes is usefull to add additional text under the product price. With this hook you can easily show additional text just under the price. You can use ScriptOrganiser, CodeSnippets or any other similar plugin. This hook could be extended to show message only on specific products. In this case you will need to add ID’s…
3rd party plugins admin after_body Alt archive Blocks Category clean up composite elemenets core CPT CSS Custom Custom Post Dashboard flexslider Front End FSE full site editing Gallery hook HTML Image load styles Must Have notice Oxygen Password Permalink plugins Post List Publish Date repeater settings page share single product Taxonomy Taxonomy Term themes Tips Topbar WooCommerce wordpress WP Admin WPML