Help Center
Adding Variation Swatches to JetWooBuilder Products Widgets

Adding Variation Swatches to JetWooBuilder Products Widgets

Create variation swatches to the JetWooBuilder widgets by using Variation Swatches for WooCommerce.

Before you start, check the tutorial requirements:

From this tutorial, you will learn how to add variation swatches to the JetWooBuilder widgets using the Variation Swatches for WooCommerce functionality.

Adding Variation Swatches to the Product Grid

Find the folder with WordPress files on your PC. Go to htdocs > wp-content > themes > your child theme folder. Add a new folder and name it jet-woo-builder.

jetwoobuilder folder

Move to the htdocs > wp-content > plugins > jet-woo-builder > templates and copy the widgets folder to the jet-woo-builder folder in the child theme’s folder.

widgets folder

Open the jet-woo-builder > widgets. The necessary widgets are located in the globalfolder, so delete the rest of the folders.

Things to know

If you work with the Products List widget, delete all the folders except for the “products-list.”

products-grid folder

Open the products-grid folder and leave only the item-buttonand loop-item files.

files in the products-grid folder

Adding CSS Classes

Open the loop-item file via Notepad, Sublime, or another code editor of your choice.

Before adding the class, check the needed one in the Archive / Shop tab of the WordPress Dashboard > GetWooPlugins > Swatches Settings directory. Here, you should find the Product wrapper field and copy its value.

variation swatches for woocommerce settings

Add the copied class to the “$classes” line:

wvs-archive-product-wrapper
classes line in the loop-item file editor

Save changes, open the item-button file, and add this code to the “$class” block:

woo_variation_swatches()->show_archive_page_swatches();
item-button file

Don’t forget to save the code.

Adding a Code to functions.php

Turn back to the htdocs > wp-content > themes > your child theme folder. Find the “functions.php” file and open it via the editor.

functions php file in the folder

Add this piece of code:

Warning

Don't add the "<?php" line to the beginning of the code snippet as it only should be added once in the beggining of the file. Copy the code beginning from the "add_filter..." value.

functions php file

Save the file and proceed to the front end to check the Products Grid widget.

products grid page

That’s all; now you know how to add variation swatches to JetWooBuilder’s widgets on your WordPress website.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 22K Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.