• nilu1992

    (@nilu1992)


    Hello! im currently trying to add this following code to a website im building for my client. The client wants the product in different color to be shown under the “Add to cart button”.

    I added following code wich works in the admin area

    add_action('woocommerce_after_add_to_cart_form','move_related_products');
    function move_related_products()
    {
    	
    	//Visar skorna "Båtsman" färg alternativ i produktmiljö
    	if(is_product() && get_the_id() == 2684){
    		echo'Finns även i';
    		echo'<div class="my-new-banner">';
    		echo do_shortcode('[products ids ="2635,2586" columns="5"]');
    		echo'</div>';
    	}
    	if(is_product() && get_the_id() == 2635){
    		echo'Finns även i';
    		echo'<div class="my-new-banner">';
    		echo do_shortcode('[products ids ="2684,2586" columns="5"]');
    		echo'</div>';
    	}
    	if(is_product() && get_the_id() == 2586){
    		echo'Finns även i';
    		echo'<div class="my-new-banner">';
    		echo do_shortcode('[products ids ="2684,2635" columns="5"]');
    		echo'</div>';
    	}
    	
    	//Visar skorna "Ronja" färg alternativ i produktmiljö
    	if(is_product() && get_the_id() == 2544){
    		echo'Finns även i';
    		echo'<div class="my-new-banner">';
    		echo do_shortcode('[products ids ="2526" columns="5"]');
    		echo'</div>';
    	}
    	
    	if(is_product() && get_the_id() == 2526){
    		echo'Finns även i';
    		echo'<div class="my-new-banner">';
    		echo do_shortcode('[products ids ="2544" columns="5"]');
    		echo'</div>';
    	}
    }
    

    Problem is its not showing when i visit the website on my phone or any other browser.
    its first time for me using codesnippets as i mostly use Custom CSS in apperance.Im clueless to why the code wont run when visiting the store from different browser.

    The page I need help with: [log in to see the link]

The topic ‘Code not showing in browser at all’ is closed to new replies.