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 […]
To remove the type attribute, simply paste this code into your theme file.
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 | add_action( 'template_redirect', 'safe_remove_template_redirect', 10, 2); function saf_remove_template_redirect(){ ob_start( function( $buffer ){ $buffer = str_replace( array( '<script type="text/javascript">', "<script type='text/javascript'>", "<script type='text/javascript' src=", '<script type="text/javascript" src=', '<style type="text/css">', "' type='text/css' media=", '<style type="text/css" media', "' type='text/css'>" ), array( '<script>', "<script>", "<script src=", '<script src=', '<style>', "' media=", '<style media', "' >" ), $buffer ); return $buffer; }); }; |
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 […]
There is a lot of information on how to export media files to a zip archive on wordpress. There are a bunch of ready-made plugins that will work and solve most of the tasks. But when there is a non-trivial task, then you need to either finish something ready, or make your own. Suppose you […]
In order to export data to Excel, you need to connect PHPExcel.php. This library is needed download, and upload to your theme folder. We connect it with the following code in the functions.php of your theme:
1 | require_once 'Classes/PHPExcel.php'; |
Next we need to call the export function, I used the GET request:
1 2 3 | if (isset($_GET['excel-export'])) { } |
You also need to […]
The iframe tag creates a window that is inside a regular document, and it allows you to load any other independent documents into the specified size. Since it is loaded from an external source, naturally it affects the page loading speed. Alternatively, you can postpone the loading of the iframe window for some time 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 […]
Get custom categories with a hierarchy on the custom post type can be done in the following way:
1 2 3 4 5 6 7 8 9 10 11 12 | <?php global $post; $taxonomy = 'ваша таксономия'; $terms = wp_get_post_terms( $post->ID, $taxonomy, array( "fields" => "ids" ) ); if( $terms ) { echo '<ul class="list">'; $terms = trim( implode( ',', (array) $terms ), ' ,' ); wp_list_categories( 'title_li=&taxonomy=' . $taxonomy . '&include=' . $terms ); echo '</ul>'; } ?> |
Source: https://clicknathan.com/web-design/hierarchical-custom-taxonomy-terms-unordered-list/
Special Mail Tags for Submissions [_remote_ip] — This tag is replaced by the submitter’s IP address. [_user_agent] — This tag is replaced by the submitter’s user agent (browser) information. [_url] — This tag is replaced by the URL of the page in which the contact form is placed. [_date] — This tag is replaced by […]