Product Analytics counter displayed in Front End Product Page

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Analytics Product Analytics counter displayed in Front End Product Page

Viewing 6 reply threads
  • Author
    Posts
    • #105168
      Kreator
      Participant

      Hi,

      I have WCFM Ultimate + Analytics module.

      I am interested in showing the number of views of products in the Front End next to Price or Stock.
      I can see them in the admin area but I want to display the numbers also in the Front End.

      Let me know what is the most easy way to do this.

      Thanks!

    • #105674
      WCFM Forum
      Member

      Hi,

      Please add this code to your site. This will show views like this – https://ibb.co/GkxR2m3

      add_action( 'woocommerce_single_product_summary', function() {
      	global $WCFM, $WCFMmp, $product;
      	$product_id = $product->get_id();
      	$views = (int) get_post_meta( $product_id, '_wcfm_product_views', true );
      	echo '<div class="wcfm_clearfix"></div><div class="wcfmmp_shipment_processing_display"><i class="wcfmfa fa-eye" aria-hidden="true"></i>&nbsp;'. __( 'Views', 'wc-multivendor-marketplace' ) . ': ' . $views .'</div><div class="wcfm_clearfix"></div>';
      }, 15 );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin –¬†https://wordpress.org/plugins/code-snippets/

      Thank You

    • #105900
      Kreator
      Participant

      Thanks for your reply, I will test this shortly!
      Can you please let me know how can I add this counter to Blog posts also/articles?

    • #106426
      WCFM Forum
      Member

      Which theme you are using for the site?

    • #111691
      Kreator
      Participant

      Martfury, thanks!

    • #112385
      Kreator
      Participant

      Any feedback on this, please? Thanks!

    • #112975
      Kreator
      Participant

      Solve it by myself. Thanks!

      $views = (int) get_post_meta( $post->ID, '_wcfm_article_views', true );

Viewing 6 reply threads
  • The topic ‘Product Analytics counter displayed in Front End Product Page’ is closed to new replies.