Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1210805
    Integratutions
    Participant

    Dear Sir/Mdm,

    Is there a way to showcase or add in some visual or functionality to showcase other color options available for my shoes on the collections page?

    http://zanetta.integratutions.com/shop/

    http://zanetta.integratutions.com/product/zh1412/

    #1211038
    Rupok
    Member

    Hi there,

    You can add some more options that you will find on the product editor but it will be shown on the single product only. Let’s explore the other options.

    Thanks!

    #1211553
    Integratutions
    Participant

    I understand that’s the current limitations. πŸ™

    What are other options that can help me do that?

    #1211683
    Thai
    Moderator

    Hi There,

    To achieve that, please add the following code under functions.php file locates in your child theme:

    add_action( 'woocommerce_before_shop_loop_item_title', 'print_color_options' );
    function print_color_options(){
    	global $product;
    	$terms = get_the_terms( get_the_ID(), 'pa_color' );
    	if($terms){
    		echo '<div class="color-options">';
    		foreach ($terms as $key => $term) {
    		    echo '<span class="'.$term->slug.'">' . $term->name . '</span>';
    		}
    		echo '</div>';
    	}
    }

    Hope it helps πŸ™‚

    #1218170
    Integratutions
    Participant

    Thank you for your reply. πŸ™‚

    I have added these to my functions.php but i didn’t see any changes. Please advice.

    #1218195
    Thai
    Moderator

    Hi There,

    In this case, would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link login to your site
    – WordPress Admin username / Password

    Don’t forget to select Set as a private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1218584
    Integratutions
    Participant
    This reply has been marked as private.
    #1218850
    Rue Nel
    Moderator

    Hello There,

    Because what you are trying to accomplish requires a template customization, we would like to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    You should place the custom code in your child theme’s functions.php file. And also, you did not set the color as the product attribute. To know more how you can properly set up a color attribute for your product, please check the documentation here: https://docs.woocommerce.com/document/variable-product/

    Hope this helps.

  • <script> jQuery(function($){ $("#no-reply-1210805 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>