Woocommerce

Hide woocommerce zero price product and related products wiget

function hide_zero_price_products( $query ) { if ( is_woocommerce() && $query->is_main_query() ) { $query->set( ‘meta_query’, array( array( ‘key’ => ‘_regular_price’, ‘compare’ => ‘>’, ‘value’ => 0, ), ) ); } } add_action( ‘woocommerce_product_query’, ‘hide_zero_price_products’ ); add_filter( ‘woocommerce_related_products_args’, function( $args ) { unset( $args[‘post__in’] ); $args[‘meta_query’] = array( ‘key’ => ‘_regular_price’, ‘compare’ => ‘>’, ‘value’ => 0, […]

Hide woocommerce zero price product and related products wiget Читать далее »

Get woo product and atribut by product category except current product

<?php global $product; $current_product_id = $product->get_id(); $category_id = get_product_cat_id(); // Replace with desired category ID $args = array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, ‘terms’ => $category_id, ‘operator’ => ‘IN’, ), ), ‘post__not_in’ => array( $current_product_id ), ); $query = new WP_Query(

Get woo product and atribut by product category except current product Читать далее »

Send email to customer when woocommerce order status changed

add_action(«woocommerce_order_status_changed», «my_awesome_publication_notification»); function my_awesome_publication_notification($order_id, $checkout=null) { global $woocommerce; $order = new WC_Order( $order_id ); if($order->status === ‘completed’ ) { // Create a mailer $mailer = $woocommerce->mailer(); $message_body = __( ‘Your track number:’ . $order->get_billing_company() ); $message = $mailer->wrap_message( // Message head and message body. sprintf( __( ‘Order %s received’ ), $order->get_order_number() ), $message_body ); //

Send email to customer when woocommerce order status changed Читать далее »

Woocommerce recently viewed products shortcode — save in COOKIES

//viewed products function custom_track_product_view() { if ( ! is_singular( ‘product’ ) ) { return; } global $post; if ( empty( $_COOKIE[‘woocommerce_recently_viewed’] ) ) $viewed_products = array(); else $viewed_products = (array) explode( ‘|’, $_COOKIE[‘woocommerce_recently_viewed’] ); if ( ! in_array( $post->ID, $viewed_products ) ) { $viewed_products[] = $post->ID; } if ( sizeof( $viewed_products ) > 15 )

Woocommerce recently viewed products shortcode — save in COOKIES Читать далее »

Automatic manage stock and backorders notify woocommerce products

/* backorder text on single product page */ function so_42345940_backorder_message( $text, $product ){ if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) { $text = __( ‘Даний товар можливо замовити, термін доставки 12-22 дні. ‘, ‘your-textdomain’ ); } return $text; } add_filter( ‘woocommerce_get_availability_text’, ‘so_42345940_backorder_message’, 10, 2 ); /*different backorder text on single product page for dif

Automatic manage stock and backorders notify woocommerce products Читать далее »

Прокрутить вверх