Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter amjulash

    (@amjulash)

    Hello, I was able to fix it. It seems with elementor pro enabled woocommerce recent viewed cookie was not working for me. So found a solution by forcing recently viewed cookie to always.

    
    // Track product views. Always
    function wc_track_product_view_always() {
        if ( ! is_singular( 'product' ) /* xnagyg: remove this condition to run: || ! is_active_widget( false, false, 'woocommerce_recently_viewed_products', true )*/ ) {
            return;
        }
    
        global $post;
    
        if ( empty( $_COOKIE['woocommerce_recently_viewed'] ) ) { // @codingStandardsIgnoreLine.
            $viewed_products = array();
        } else {
            $viewed_products = wp_parse_id_list( (array) explode( '|', wp_unslash( $_COOKIE['woocommerce_recently_viewed'] ) ) ); // @codingStandardsIgnoreLine.
        }
    
        // Unset if already in viewed products list.
        $keys = array_flip( $viewed_products );
    
        if ( isset( $keys[ $post->ID ] ) ) {
            unset( $viewed_products[ $keys[ $post->ID ] ] );
        }
    
        $viewed_products[] = $post->ID;
    
        if ( count( $viewed_products ) > 15 ) {
            array_shift( $viewed_products );
        }
    
        // Store for session only.
        wc_setcookie( 'woocommerce_recently_viewed', implode( '|', $viewed_products ) );
    }
    remove_action('template_redirect', 'wc_track_product_view', 20);
    add_action( 'template_redirect', 'wc_track_product_view_always', 20 );
    

    Then set a custom posts query to show recently viewed products in elementor’s posts widget.

    
    // Elemento posts query to show recently viewed products
    add_action( 'elementor/query/customquery', function( $query ) {
    	
    	// Get WooCommerce Global
    	global $woocommerce;
    
    	// Get recently viewed product cookies data
    	$viewed_products = ! empty( $_COOKIE['woocommerce_recently_viewed'] ) ? (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] ) : array();
    	$viewed_products = array_filter( array_map( 'absint', $viewed_products ) );
    
    	// If no data, quit
    	if(empty($viewed_products)) {
    		return;
    	}
    	
    	$query->set( 'post__in', $viewed_products );
    
    });
    

    Hope to see this fixed and support on elementor.

    Thanks
    Julash

    Hi, I am having the same issue with Bangla font and installed mPDF version from here https://github.com/wpovernight/woocommerce-pdf-ips-mpdf/releases, both CJK and non CJK.

    But when mpdf version enable, whatever the template or with custom font for Simple MPDf version, bangla font showing as box.

    It seems mpdf version is 2.2, are you not supporting it anymore. Really need your plugin for the sign feature after pdf downloads.

    Thanks
    Julash

    Thread Starter amjulash

    (@amjulash)

    Thank you very much for the plugin suggestion. But $200-$500/year for each location will surely hurt the store revenue.

    Any way to do this using Woocommerce hooks for different user labels or user id?

    Thread Starter amjulash

    (@amjulash)

    HI Alex,

    Thank you for your answer. Will locking cart going to prevent customers from adding products from different locations? Will this going to work for page builders like elementor?

    In case of things do not work, I was thinking to add a custom widget with location dropdown somewhere and let customers select location only from that widget. That widget will store a cookie and I will modify product page location dropdown to only auto select the location user selected from the widget cookie. There will be css modifications, so once user select location from the widget, they wont be able to see other stock location on product and cart.

    I only know very little about coding by searching, so not sure if this will work. But will try my best and let you know update.

    Thanks
    Julash

    Thread Starter amjulash

    (@amjulash)

    Hi @publishpress

    I have followed this guide https://publishpress.com/blog/add-authors-woocommerce-products/ before submitting this support post. I also tried with “Change Product Author for WooCommerce”, “WC Author Change” plugin and the PHP function code mentioned on the above guide. But no luck.

    To check if there any conflict with other plugin, I tried by deactivating all other plugging installed on my website except woocommerce and “PublishPress Authors”, still there no publisepress multi author box except just the single choice author box.

    There was no box of publisepress multi author in Screen Option too.

    Please kindly check.

    Bytheway, do you think it will be possible to let woocommerce multi-vendors (multi author) to edit the same product with help of publishpress authors plugin using vendor plugin like WCFM from wc-lovers.com or dokan from wedevs.com/dokan?

    Thanks
    Julash

Viewing 5 replies - 1 through 5 (of 5 total)