fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Change Positioning of Swatch graphics location

Shagun Sharma

Hello, we previously emailed you before on this but it appears it did not go through or was received.  We are using the Variation Swatches plugin and have 2 questions:

1 – How can we center the position of the swatches graphic – right now it is too far left-justified under the product?

2 – Are we also able to change the location that this displays to being right underneath the photo of the product, before the description and price?

I could not see in the plugin options how to do that.  Thank you for any help you can provide.  I have attached a screenshot showing how the swatch graphic is coming up now – and made a couple of arrows showing how we’d like to reposition it.   Right now this is on our DEV site for testing before we move it to the live environment.

Swatch Locations.JPG

Thank you,

Shagun Sharma – Naytra Couture

Hakik Zaman

Hi Shagun,

Thanks for reaching us. We are sorry for your inconvenience.

You can center the swatch position from Swatches > Archive/Shop > Swatches align. Check this screenshot.

To change the swatch location, could you send us the latest version of the theme that you are using on your site? We’ll try to investigate your issue by installing your theme on our local setup.

You can upload the theme file in Dropbox or Google Drive and send the download link here directly.

Looking forward to hearing from you soon.

Thank you

Hakik Zaman

Hello Shagun,

Thanks for sharing your theme. Please create a child theme or use code snippet plugin. Then put the below code to your child theme’s functions.php or make a PHP snippet using the code snippet plugin.

function wvs_salient_support(){
   remove_action( 'woocommerce_after_shop_loop_item', 'wvs_pro_archive_variation_template', 30 );
   add_action( 'woocommerce_before_shop_loop_item_title', 'wvs_pro_archive_variation_template', 30 );
}
add_action('init', 'wvs_salient_support');

Note: You can also put it inside your parent theme, but it is not good practice. Because, if you update your parent theme all custom code will be removed.

Please let me know, is it resolved your issue or not. Hope to hear from you soon.

Thanks

Shagun Sharma

Hello thank you for your help, I did as you instructed but am now seeing this appear as double – the position has not changed otherwise.

Please let me know what I should do thanks vm,

Hakik Zaman

Hello Shagun,

Sorry for your inconvenience. You are not using the default shop layout of WooCommerce. You are using WPBakery shop layout.

Unfortunately, there is no hook (inside your theme) to show the swatches before the product title. But you can display it before the product price.

Note: Swatches can be displayed after the product thumbnail and before the product title if you add an action hook to the parent theme. But it is not a wise decision because this change will disappear on each update of your theme.

Please let me know if you want swatches before the product price. Hope to hear from you soon.

Thanks

Shagun Sharma

Hi Hakik, thank you for your reply – yes in that case we will take what we can and we will be open to display the swatches before the product price.  Please let us know what to do thanks again.

Shagun

Hakik Zaman

Hello Shagun Sharma,

I have created two snippets for you here. Please activate them (one by one) and check which one fits your need.

You have customized your parent theme. Therefore, I have overridden your content-product.php and paste the file inside your child theme. Then commented line number 92here.

I hope, it will resolve your issue. If you found my support helpful, my humble request to you to write your beautiful thought here-

here: https://wordpress.org/support/plugin/woo-variation-swatches/reviews/?filter=5

Your rating keeps us inspired.

Thank You

Shagun Sharma

Hi Hakik, thank you so much that is fantastic!  One final question, I noticed there is a small ‘Clear’ underneath and wonder how to remove that – is that because I am logged in or something?

 

Thank you,

Shagun

Hakik Zaman

Hello Shagun,

You have customized many things and kept clear CSS display: block with !important.

Here is a screenshot for you. I have added the below code to Appearance > Customize > Additional CSS

.archive .variations .reset_variations.woo_variation_swatches_archive_reset_variations {
   display: none !important;
}

Now, the clear link will be invisible.

Thanks