Showing posts with label Woocommerce. Show all posts
Showing posts with label Woocommerce. Show all posts

Sunday, 1 November 2015

disable the review tab in Woocommerce

Disabling the Reviews Tab
put the below code in theme  functions.php file:

add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 );
function wcs_woo_remove_reviews_tab($tabs) {
 unset($tabs['reviews']);
 return $tabs;
}

Tuesday, 27 October 2015

display attributes & SKU of products in Woocommerce

=======================display SKU When $product is pre defined on page===========

<p>SKU :&nbsp;<?php echo $product->get_sku(); ?><?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?><br>
                              <?php echo $product->get_attribute( 'your_attr' );
                $array=get_post_meta($product->id);
         ?>
                         
 =====================Get attributes when $product is defined on page=================

//fetching attributes have name Care Instruction
     Care Instruction : <?php echo  $product->get_attribute( 'Care Instruction' ); ?>

change related products thumbnail size in WooCommerce

change in this file which shown below
 wp-content/plugins/woocommerce/includes/ wc-template-functions.php

filename : wc-template-functions.php

function woocommerce_template_loop_product_thumbnail() {
  echo str_replace('-300x300','',woocommerce_get_product_thumbnail());
 }
}

Monday, 25 May 2015

get cart item name, quantity and all details in woocommerce

<?php
    global $woocommerce;
    $items = $woocommerce->cart->get_cart();

        foreach($items as $item => $values) {
            $_product = $values['data']->post;
            echo "<b>".$_product->post_title.'</b>  <br> Quantity: '.$values['quantity'].'<br>';
            $price = get_post_meta($values['product_id'] , '_price', true);
            echo "  Price: ".$price."<br>";
        }
?>

to remove products from cart in woocommerece

<?php
    echo apply_filters(
        'woocommerce_cart_item_remove_link',
        sprintf(
            '<a href="%s" class="remove" title="%s">&times;</a>',
            esc_url( $woocommerce->cart->get_remove_url( $cart_item_key ) ),
            __( 'Remove this item', 'woocommerce' )
        ),
        $cart_item_key
    );
?>