Forum Replies Created

Viewing 4 replies - 511 through 514 (of 514 total)
  • Plugin Support Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    Hi. You can hook into the product summary using the woocommerce_single_product_summary action. Add this code to your functions.php file. It will add a link to the bottom of the short description that points to the full description. I’ve added the css class custom_more_info in case you want to style the link.

    add_action('woocommerce_single_product_summary','woocommerce_scroll_for_more_info', 20);
    
    function woocommerce_scroll_for_more_info() {
    	echo '<a class="custom_more_info" href="#tab-description">Click here for more info</a>';
    }

    Hope that helps.

    Plugin Support Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    Hi. I assume you’re doing a template override on related.php. If not, you can read up on it here.
    https://docs.woothemes.com/document/template-structure/

    It looks like you’re using a custom taxonomy of ‘ranges’. I’ve edited related.php to check for terms in the ranges taxonomy and display related products based on those terms. If no terms are found, the default related products will be displayed.

    <?php
    /**
     * Related Products
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     1.6.4
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    global $product, $woocommerce_loop;
    
    if ( empty( $product ) || ! $product->exists() ) {
    	return;
    }
    
    //If ranges custom taxonomy, show related ranges
    if ($ranges = get_the_terms($product->id, 'ranges')) {
    
    	//Ranges IDs array
    	$ranges_ids = array();
    
    	foreach($ranges as $range) {
    		$ranges_ids[] = $range->term_id;
    	}
    
    	//Create the args
    	$args = array(
    		'post_type'				=> 'product',
    		'ignore_sticky_posts'	=> 1,
    		'posts_per_page'		=> $posts_per_page,
    		'no_found_rows' 		=> 1,
    		'orderby' 				=> $orderby,
    		'post__not_in'			=> array($product->id),
    		'tax_query'				=> array(array(
    										'taxonomy'	=> 'ranges',
    										'field'		=> 'id',
    										'terms'		=> $ranges_ids,
    									)),
    	);
    } else {
    
    	$related = $product->get_related( $posts_per_page );
    
    	if ( sizeof( $related ) == 0 ) return;
    
    	$args = apply_filters( 'woocommerce_related_products_args', array(
    		'post_type'            => 'product',
    		'ignore_sticky_posts'  => 1,
    		'no_found_rows'        => 1,
    		'posts_per_page'       => $posts_per_page,
    		'orderby'              => $orderby,
    		'post__in'             => $related,
    		'post__not_in'         => array( $product->id )
    	) );
    
    }
    
    $products = new WP_Query( $args );
    
    $woocommerce_loop['columns'] = $columns;
    
    if ( $products->have_posts() ) : ?>
    
    	<div class="related products">
    
    		<h2><?php _e( 'Related Products', 'woocommerce' ); ?></h2>
    
    		<?php woocommerce_product_loop_start(); ?>
    
    			<?php while ( $products->have_posts() ) : $products->the_post(); ?>
    
    				<?php wc_get_template_part( 'content', 'product' ); ?>
    
    			<?php endwhile; // end of the loop. ?>
    
    		<?php woocommerce_product_loop_end(); ?>
    
    	</div>
    
    <?php endif;
    
    wp_reset_postdata();

    Let me know if this works for you.

    Plugin Support Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    Are you sure the prices have been removed from the database? Are they still showing up in the admin when you edit a product?

    Plugin Support Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    Your function looks good. You just need to change the add_filter() function to call the function you’ve defined below. You’ll want this in your theme’s functions.php file so you may want to remove the code you added to wc-template-functions.php.

    Change this:

    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );

    to

    add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_woocommerce_product_add_to_cart_text' );

    .

    Then, in the custom_woocommerce_product_add_to_cart_text() function, change Buy product to whatever you would like to use for external products. Hope that helps.

Viewing 4 replies - 511 through 514 (of 514 total)