Hooks and Shortcodes
Last updated
Last updated
Hooks
Filter yay_swatches_show_all_pages hook is used to display YaySwatches on a page.
Currently in YaySwatches settings, attributes are displayed only on Single Product Page and Shop/Categories Page. To display YaySwatches on other pages, you can add the following code to Code Snippets or to the file functions.php
of your theme.
Filter hook to show/hide term name on variant: yay_swatches_show_term_name_variant_button, yay_swatches_show_term_name_variant_custom, yay_swatches_show_term_name_variant_image
Shortcodes
[yay-swatches-variant-html]
: You can use this shortcode to display YaySwatches by product ID
Eg: Display attribute of product ID 21
[yay-swatches-variant-loop]
shortcode is to show YaySwatches in Products Loop.
These provided hooks and shortcodes are fully functional only in the YaySwatches pro version.