Add to checkout total lines an additional line below shipping in WooCommerce

You could use the Fee API that will create in totals line below shipping optionsCode goes in function.php file of your active child theme (or active theme). Tested and works., based on the shipping total x 1.5 (+50%), where you can include your conditional logic, like: add_action( ‘woocommerce_cart_calculate_fees’,’custom_pack_fee’, 10 , 1 ); function custom_pack_fee( $cart … Read more

Add a custom text field to WooCommerce admin product data “Variations”

Overriding core files is really something to avoid absolutely for many reasons. To add a custom field to product variations options prices and save the value on save, use this: // Admin: Add custom field in product variations options pricing add_action( ‘woocommerce_variation_options_pricing’, ‘add_variation_custom_option_pricing’, 10, 3 ); function add_variation_custom_option_pricing( $loop, $variation_data, $variation ){ woocommerce_wp_text_input( array( ‘id’ … Read more

How to display product cropped thumbnail (150×150) for WooCommerce product categories

To include the product category thumbnail (125 × 125 px) in your product category items (buttons), use the following: $product_cats = get_terms([ ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => true, ‘parent’ => 0, ]); foreach ( $product_cats as $key => $parent_term ) { $thumb_id = get_woocommerce_term_meta( $parent_term->term_id, ‘thumbnail_id’, true ); $size=”thumbnail”; $image = wp_get_attachment_image_src($thumb_id, $size); printf( ‘<button … Read more

Button to update order status Woocommerce with WC Marketplace

Thank you all, I did found the answer HERE. I adapt a bit the code to my needs and added a button. html: <div> <form method=”post” name=”update_status”> <button type=”submit” name=”marked_as_completed”>Mark as Completed</button> </form> </div> php: <?php if (isset($_POST[“marked_as_completed”])) { $completed_status = $order->get_id(); $order = new WC_Order($completed_status); $order->update_status(‘completed’, ‘order_note’); echo ‘<h2 style=”color:green;”>Completato &check;</h2>’; } ?>

Customize WooCommerce orders displayed shipping

There are mainly 2 filters to be used: 1) the filter woocommerce_order_shipping_to_display located in get_shipping_to_display() method, used by get_order_item_totals() method to display the shipping in order total rows: add_filter( ‘woocommerce_order_shipping_to_display’, ‘customize_order_shipping_to_display’, 10, 3 ); function customize_order_shipping_to_display( $shipping, $order, $tax_display ){ // Your code to filter displayed shipping return $shipping; } 2) Or filter woocommerce_get_order_item_totals located … Read more

Remove pagination from WooCommerce product categories on admin edit navigation menus

Based on “Remove Pagination in Appearance -> Menus -> Categories“ answer thread for WordPress categories, you will adapt the answer code to WooCommerce Product Categories. The taxonomy of WooCommerce Product category is product_cat. Is also better to target admin nav menus only. Try the following (untested): add_filter( ‘get_terms_args’, ‘admin_nav_menu_show_all_product_categories’, 10, 2); function admin_nav_menu_show_all_product_categories( $args, $taxonomies … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)