How to add a wrapper element on image for products page

I think I solved, it was simpler than I thought remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_thumbnail’, 10); add_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_thumbnail’, 10); /** * WooCommerce Loop Product Thumbs **/ if ( ! function_exists( ‘woocommerce_template_loop_product_thumbnail’ ) ) { function woocommerce_template_loop_product_thumbnail() { echo “<div class=”wc-img-wrapper”>”; echo woocommerce_get_product_thumbnail(); echo “</div>”; } }

Adding discount functionality to the cart

after quite some headbanging I managed to make it somehow to work. Here is my code: add_action( ‘woocommerce_cart_calculate_fees’, ‘iom_add_custom_discount’, 10, 1 ); function iom_add_custom_discount( $wc_cart ){ $discount = 0; $product_ids = array(); $product_ids_disc = array(); $item_prices = array(); $in_cart = false; foreach ( $wc_cart->get_cart() as $cart_item_key => $cart_item ) { $cart_product = $cart_item[‘data’]; // here … Read more

How to use decimal in quantity fields in WooCommerce for certain categories?

check this sample code : add_filter(‘woocommerce_quantity_input_min’, ‘min_decimal’, 10, 2); function min_decimal($val, WC_Product $product) { if(get_the_category($product->id) == 12) { // 12 = ID on the category you want it to work with return 0.1; } return 1; } add_filter(‘woocommerce_quantity_input_step’, ‘step_decimal’, 10, 2); function step_decimal($val, WC_Product $product) { if(get_the_category($product->id) == 12) { // 12 = ID on … Read more