Add text before or after shop swatches

You are here:
← All Topics

This article belongs to our plugin : Woocommerce Color or Image Variation Swatches

To use this plugin you will need plugin version 3.0.15 or higher.

To add text before attribute swatches use this code snippet

add_action('wcva_before_shop_swatches','wcva_add_text_before_swatches',10,2);

function wcva_add_text_before_swatches($product_id,$attribute) {
    if ($attribute == 'pa_size') {
        echo 'Available Sizes :';
    }
}

To add text after shop swatches use this code snippet

add_action('wcva_after_shop_swatches','wcva_add_text_before_swatches',10,2);

function wcva_add_text_before_swatches($product_id,$attribute) {
    if ($attribute == 'pa_size') {
        echo 'Available Sizes :';
    }
}

To insert extra php code you may use Code Snippets plugin.

Sidebar