Item view - Move price after description

eCommerce WordPress theme with various e-store features and WooCommerce support.
GK User
Tue Nov 25, 2014 8:23 pm
Hi guys I need your help.

In product view, I need to move price AFTER the description, just before the add to cart button.

In this way, I'll see : Title > description > price > add to cart

Is it possible? Can you help me?

Thank you!
User avatar
Expert Boarder

GK User
Wed Nov 26, 2014 9:15 am
Hi,
Try to add the following code into StoreBox/gavern/wc-functions.php file:

Code: Select all
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 30 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 35 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
User avatar
Moderator

GK User
Wed Nov 26, 2014 12:05 pm
Thank you Piotr, where exactly?

I see:

Code: Select all
<?php

/**
 *
 * Woocommerce functions:
 *
 **/
 
global $tpl;
 
// Disable woocommerce default CSS
if (get_option($tpl->name . '_woocommerce_css', 'Y') == 'Y') {
   if ( version_compare( WOOCOMMERCE_VERSION, "2.1" ) >= 0 ) {
      add_filter( 'woocommerce_enqueue_styles', '__return_false' );
   } else {
      define( 'WOOCOMMERCE_USE_CSS', false );
   }
}

// Display 9 products per page.
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 9;' ), 20 );

// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
   if (!function_exists('loop_columns')) {
      function loop_columns() {
      return 3; // 3 products per row
      }
   }

// Change number of related products on product page, use your own value for posts_per_page
function gavern_related_products_limit() {
    global $product;   
    $args = array(
            'post_type'             => 'product',
            'posts_per_page'        => 4
        );
    return $args;
}
add_filter( 'woocommerce_related_products_args', 'gavern_related_products_limit' );

// Redefine the breadcrumb
function gavern_woocommerce_breadcrumb() {
   woocommerce_breadcrumb(array(
      'delimiter'   => '',
      'wrap_before' => '<div class="gk-woocommerce-breadcrumbs">',
      'wrap_after'  => '</div>',
      'before' => '<span>',
      'after' => '</span>'
   ));
}

// remove old breadcrumb callback
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
// add our own breadcrumb callback
add_action( 'woocommerce_before_main_content', 'gavern_woocommerce_breadcrumb', 20, 0);

// Display short description on catalog pages.
function wc_short_description($amount) {
   global $product;
   global $woocommerce;
   
   $input = $product->get_post_data()->post_excerpt;
   $output = '';
   $input = strip_tags($input);
   
   if (function_exists('mb_substr')) {
      $output = mb_substr($input, 0, $amount);
      if (mb_strlen($input) > $amount){
         $output .= '&hellip;';
      }
   }
   else {
      $output = substr($input, 0, $amount);
      if (strlen($input) > $amount){
         $output .= '&hellip;';
      }
   }   
   
   return '<p class="short-desc">'.$output.'</p>';
}


//remove add to cart, select options buttons on catalog pages
if(!(get_option($tpl->name . '_woocommerce_show_loop_button', 'Y') == 'Y')) :
function remove_loop_button(){
   remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}

add_action('init','remove_loop_button');
endif;
User avatar
Expert Boarder

GK User
Wed Nov 26, 2014 1:08 pm
You can add the code at the end of this file.
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.