How to make Quantity box with plus and minus buttons in woocommerce like this: Step 1. Add buttons Go to folder /wp-content/plugins/woocommerce/templates/global, and copy file quantity-input.php to folder your-theme/woocommerce/global/ Edit the file and add two buttons to it. Example: In this code, we have inserted these two buttons: And added custom classes. Step 2. Add […]
We know that woocommerce is a widely used plugin to build shopping websites in wordpress. So, when we are adding products we have a section named “Product Data” just below the content editor. In this section we have various tabs like general, inventory, linked products etc. Sometimes we do not use few of them, so […]
In order to set the minimum order amount in woocommerce, you need to place the following code in the function.php file of your theme:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | function wc_minimum_order_amount() { // Set this variable to specify a minimum order value $minimum = 2500; if ( WC()->cart->total < $minimum ) { if( is_cart() ) { wc_print_notice( sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' , wc_price( $minimum ), wc_price( WC()->cart->total ) ), 'error' ); } else { wc_add_notice( sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' , wc_price( $minimum ), wc_price( WC()->cart->total ) ), 'error' ); } } } add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' ); add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' ); |
To change thumbnail image size of WooCommerce cart page you need next steps: 1. in function.php create the size you need.
1 2 3 | if ( function_exists( 'add_image_size' ) ) { add_image_size( 'custom-thumb', 100, 100 ); // 100 wide and 100 high } |
2. in cart.php which should be located in your_tneme\woocommerce\cart find
1 | $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key ); |
and in get_image() write the name of your size. In our case it will be like this: get_image(‘custom-thumb’) Checked work on WooCommerce […]
The gallery made on Slick. Part of the code is peeped here So, the code is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | <?php function woocommerce_archive_gallery() { global $product; $post_ids = $product->get_id(); $attachment_ids = $product->get_gallery_attachment_ids(); echo '<div class="mainimg feature-slider-'; echo $post_ids; echo '">'; echo '<div>'; echo get_the_post_thumbnail( $post->ID, 'shop_single', $attributes ); echo '</div>'; foreach( $attachment_ids as $attachment_id ) { echo '<div>'; echo wp_get_attachment_image( $attachment_id, 'shop_catalog' ); echo '</div>'; } echo '</div>'; echo '<div class="thumb thumbnail-slider-'; echo $post_ids; echo '">'; echo '<div>'; echo get_the_post_thumbnail( $post->ID, 'shop_single', $attributes ); echo '</div>'; foreach( $attachment_ids as $attachment_id ) { echo '<div>'; echo wp_get_attachment_image( $attachment_id, 'shop_catalog' ); echo '</div>'; } echo '</div>'; ?> <script> $(document).ready(function() { $('.feature-slider-<?php echo $post_ids; ?>').slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false }); $('.thumbnail-slider-<?php echo $post_ids; ?>').slick({ slidesToShow: 4, slidesToScroll: 1, asNavFor: '.feature-slider-<?php echo $post_ids; ?>', dots: false, centerMode: true, focusOnSelect: true }); }); $('.slick-slide').mouseover(function(){ $(this).click(); }); </script> <?php } remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); //Убираем вывод картинки по умолчанию add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_archive_gallery', 8 ); |
It is enough to insert this code into the functions.php of your theme. You also need to connect scripts Slick slider.