Showing posts with label woocommerce. Show all posts
Showing posts with label woocommerce. Show all posts
Thursday, February 27, 2020
Sunday, April 21, 2019
How to use WooLentor – WooCommerce Addons for Elementor Page Builder
WooLentor is a WooCommerce Add-ons for Elementor Page Builder. 42 product layouts, awesome style options. It can show the latest products, Best Selling products, On Sale Products, Featured products, Category products. This plugin has the options to add unlimited background colors and images to make your product slider/Tab more professional. You can see the plugin demo here: http://demo.wphash.com/woolentor/ Download Our Free WooCommerce Theme Parlo WooCommerce Theme https://freethemescloud.com/item/parlo-free-woocommerce-theme/
Friday, December 16, 2016
Change add to cart button text in WooCommerce
Subscribe to our Youtube Channel: Get notification for our Latest Videos
Sunday, April 24, 2016
How to show Related Products by Product Categories only in Woocommerce
In the abstract-wc-product.php file in the woocommerce/includes/abstracts/ folder remove the following line
// Get tags
$terms = wp_get_post_terms( $this->id, 'product_tag' );
foreach ( $terms as $term ) {
$tags_array[] = $term->term_id;
}
Visit Our Online Store: http://devitems.com/
// Get tags
$terms = wp_get_post_terms( $this->id, 'product_tag' );
foreach ( $terms as $term ) {
$tags_array[] = $term->term_id;
}
Visit Our Online Store: http://devitems.com/
Monday, August 24, 2015
How to Remove the Billing Details from WooCommerce Checkout
Here’s how to do it, you can place this code in your theme’s functions.php file.
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_email']);
unset($fields['billing']['billing_city']);
return $fields;
}
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_email']);
unset($fields['billing']['billing_city']);
return $fields;
}
Sunday, April 19, 2015
How to show number of items in cart and total in WordPress Header or Menu Section
Add this code to you Functions.php file
//check if woocommerce plugin is activated
if ( ! function_exists( 'is_woocommerce_activated' ) ) {
function is_woocommerce_activated() {
if ( class_exists( 'woocommerce' ) ) {
return true;
}
else {
return false;
}
}
}
//showing cart header menu item
function andro_cart_menu_item() {
if(is_woocommerce_activated()){
?>
<li class="border"><a class="cart collapsed" data-target=".shopping-bag" href="javascript:;">
<span class="cart-icon"><?php esc_attr_e('Cart','andro');?></span>
<?php
global $woocommerce;
$my_cart_count = $woocommerce->cart->cart_contents_count;
echo '<span class="cart-number-box';
if ($my_cart_count > 0) {
echo ' active';
}
echo '">';echo sprintf( _n('%d', '%d', $woocommerce->cart->cart_contents_count, 'woothemes' ), $woocommerce->cart->cart_contents_count );
echo '</span>';
?>
</a></li>
<?php }
}
function andro_cart_shopping_bag(){
if(is_woocommerce_activated()){
?>
<div class="shopping-bag">
<?php
if ( version_compare( WOOCOMMERCE_VERSION, "2.0.0" ) >= 0 ) {
the_widget( 'WC_Widget_Cart', 'title=' );
} else {
the_widget( 'WooCommerce_Widget_Cart', 'title=' );
} ?>
</div>
<?php
}
}
add_filter( 'add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
if ( ! function_exists( 'woocommerce_header_add_to_cart_fragment' ) ) {
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
<?php
echo '<span class="cart-number-box';
$my_cart_count = $woocommerce->cart->cart_contents_count;
if ($my_cart_count > 0) {
echo ' active';
}
echo '">';
?>
<?php
echo sprintf( _n('%d', '%d', $woocommerce->cart->cart_contents_count, 'woothemes' ), $woocommerce->cart->cart_contents_count );
?></span>
<?php
$fragments['span.cart-number-box'] = ob_get_clean();
return $fragments;
} // End woocommerce_header_add_to_cart_fragment()
}
After that add this code to your header.php
To show the cart count:
<?php echo sprintf (_n( '%d item', '%d items', $woocommerce->cart->cart_contents_count ), $woocommerce->cart->cart_contents_count ); ?> - <?php echo $woocommerce->cart->get_cart_total(); ?>
or
<?php if (class_exists('Woocommerce')) {andro_cart_menu_item();} ?>
To show the cart bag or cart Widget:
<?php if (class_exists('Woocommerce')) {andro_cart_shopping_bag();} ?>
Sample Header:
<div class="top-cart">
<div id="cart" class="btn-group btn-block">
<button type="button" data-toggle="dropdown" data-loading-text="Loading..." class="btn btn-inverse btn-block btn-lg dropdown-toggle">
<span class="top-cart-contain">
<span class="title-cart"></span>
<span id="cart-total">
<?php echo sprintf (_n( '%d item', '%d items', $woocommerce->cart->cart_contents_count ), $woocommerce->cart->cart_contents_count ); ?> - <?php echo $woocommerce->cart->get_cart_total(); ?>
<?php if (class_exists('Woocommerce')) {andro_cart_menu_item();} ?>
</span>
<i class="fa fa-caret-down"></i>
</span>
</button>
<ul class="dropdown-menu pull-right">
<li class="arrow-cart"></li>
<li>
<?php if (class_exists('Woocommerce')) {andro_cart_shopping_bag();} ?>
</li>
</ul>
</div>
</div>
Monday, April 6, 2015
Add a custom tab to woocommerce single product page
Add this below code to your functions.php file. Then chnage the line that shows
echo '<p>Here\'s your new product tab.</p>';
You can create a meta field for single product and echo that field here.
echo '<p>Your Meta box output code here</p>';
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo '<h2>New Product Tab</h2>';
echo '<p>Here\'s your new product tab.</p>';
}
#Use the following snippet to change the tab order
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third
return $tabs;
}
echo '<p>Here\'s your new product tab.</p>';
You can create a meta field for single product and echo that field here.
echo '<p>Your Meta box output code here</p>';
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo '<h2>New Product Tab</h2>';
echo '<p>Here\'s your new product tab.</p>';
}
#Use the following snippet to change the tab order
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 );
function woo_reorder_tabs( $tabs ) {
$tabs['reviews']['priority'] = 5; // Reviews first
$tabs['description']['priority'] = 10; // Description second
$tabs['additional_information']['priority'] = 15; // Additional information third
return $tabs;
}
Saturday, April 4, 2015
How to Override woocommerce widgets
Here, I tried to show how to override WooCommerce Price Filter widget.
At first Add this below code to your functions.php file. copy the class-wc-widget-price-filter.php file from wp-content\plugins\woocommerce\includes\widgets to your theme file and include that by
include_once or include get_template_directory()
/*-------------------------------
Override woocommerce product categories widgets
---------------------------------*/
add_action( 'widgets_init', 'override_woocommerce_widgets', 15 );
function override_woocommerce_widgets() {
// Ensure our parent class exists to avoid fatal error
if ( class_exists( 'WC_Widget_Price_Filter' ) ) {
unregister_widget( 'WC_Widget_Price_Filter' );
include_once( 'inc/custom-widgets/fengo-class-wc-widget-price-filter.php' );
//or
//include get_template_directory() . '/inc/custom-widgets/fengo-class-wc-widget-price-filter.php';
register_widget( 'Fengo_WC_Widget_Price_Filter' );
}
}
At first Add this below code to your functions.php file. copy the class-wc-widget-price-filter.php file from wp-content\plugins\woocommerce\includes\widgets to your theme file and include that by
include_once or include get_template_directory()
/*-------------------------------
Override woocommerce product categories widgets
---------------------------------*/
add_action( 'widgets_init', 'override_woocommerce_widgets', 15 );
function override_woocommerce_widgets() {
// Ensure our parent class exists to avoid fatal error
if ( class_exists( 'WC_Widget_Price_Filter' ) ) {
unregister_widget( 'WC_Widget_Price_Filter' );
include_once( 'inc/custom-widgets/fengo-class-wc-widget-price-filter.php' );
//or
//include get_template_directory() . '/inc/custom-widgets/fengo-class-wc-widget-price-filter.php';
register_widget( 'Fengo_WC_Widget_Price_Filter' );
}
}
Tuesday, February 3, 2015
Display the number of Products Sold in WooCommerce
//To display the number of units sold for a product, add the following snippet of code to your theme’s functions.php file
<?php
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
function wc_product_sold_count() {
global $product;
$units_sold = get_post_meta( $product->id, 'total_sales', true );
echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>';
}
?>
//or Where You want to show
<?php echo get_post_meta($post->ID, 'total_sales', true); ?>
<?php
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
function wc_product_sold_count() {
global $product;
$units_sold = get_post_meta( $product->id, 'total_sales', true );
echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>';
}
?>
//or Where You want to show
<?php echo get_post_meta($post->ID, 'total_sales', true); ?>
Monday, January 12, 2015
Set WooCommerce image dimensions at the time of theme activation
Add this code to your functions.php file
/*** Hook in on activation*//*** Define image sizes*/function yourtheme_woocommerce_image_dimensions() {global $pagenow;if ( ! isset( $_GET['activated'] ) || $pagenow != 'themes.php' ) {return;}$catalog = array('width' => '400', // px'height' => '400', // px'crop' => 1 // true);$single = array('width' => '600', // px'height' => '600', // px'crop' => 1 // true);$thumbnail = array('width' => '120', // px'height' => '120', // px'crop' => 0 // false);// Image sizesupdate_option( 'shop_catalog_image_size', $catalog ); // Product category thumbsupdate_option( 'shop_single_image_size', $single ); // Single product imageupdate_option( 'shop_thumbnail_image_size', $thumbnail ); // Image gallery thumbs}add_action( 'after_switch_theme', 'yourtheme_woocommerce_image_dimensions', 1 );
Wednesday, April 16, 2014
How to change add to cart text in woocommerce
For Single product page
Add this below code to your theme functions.php file
//for < 2.1
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
// for 2.1 +
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
For Product Category Page
Add this below code to your functions.php file
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // for < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // for 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
Add this below code to your theme functions.php file
//for < 2.1
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
// for 2.1 +
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
For Product Category Page
Add this below code to your functions.php file
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // for < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // for 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
Subscribe to:
Posts (Atom)
-
1. Download owl-carousel from http://owlgraphic.com/owlcarousel/ 2. Collect files from zip folder · AjaxLoader...
-
Step 1: At first close Xamp. Browse and open the following 3 files C:\Program Files\xampp\apache\bin\php.ini C:\Program Files\xampp\ph...
-
Here, I tried to show how to override WooCommerce Price Filter widget. At first Add this below code to your functions.php file. copy the...
