title: Woocommerce Breadcrumbs, Replace Product Category with Page Number on Single Product Pages
body: <p>I'm redesigning my website and am having trouble with the breadcrumbs. I would like to replace the product category with the page number which the currently selected product originated from.
  So instead of:  Home > Shop > abstract > product name
  I would like:   Home > Shop > Page 3 > product name</p>
  
  <p>The reason for this is my site is used for displaying/selling my art and the product category in the breadcrumb just doesn't make sense. I would like the customer to be able to return to the page they came from and not a new page of products that happen to be in the same category.</p>
  
  <p>My site is <a href="https://dev.paulruskin.com" rel="nofollow noreferrer">https://dev.paulruskin.com</a> and I'm using the Storefront theme in WordPress.</p>
  
  <p>I have searched extensively on here and googled the heck out of it but can't seem to find a good enough example.</p>
  
  <p>Any help will be greatly appreciated. </p>
  
  <p><strong>EDIT:</strong><br>
  So this is what I came up with so far.  </p>
  
  <pre><code>add_filter( 'woocommerce_get_breadcrumb', 'custom_breadcrumb', 10, 2 );
  function custom_breadcrumb( $crumbs ) {
      $url = $_SERVER['HTTP_REFERER'];
      $url_array = array_values( explode("/", $url) );
      $pg_num = $url_array[count($url_array) -2];
  
      if ( strpos( $url, '/page/') !== false ) {
  
          foreach( $crumbs as $key =&gt; $crumb ) {
              $taxonomy = 'product_cat';
  
              $term_array = term_exists( $crumb[0], $taxonomy );
  
              if ( $term_array !== 0 &amp;&amp; $term_array !== null ) {
                  $crumbs[$key][0] = "Page " . $pg_num;
                  $crumbs[$key][1] = $url;
              }
          }
      }
      return $crumbs;
  }'  
  </code></pre>
  
  <p>This only partially works. What I realized is if the user clicks the prev or next buttons then the previous url won't still list the page number.</p>
  
  <p>Is there a way to get the page number from Woocommerce or WordPress that a product belongs to? </p>