• Resolved chrisoko7

    (@chrisoko7)


    Hello!
    I have been having a horrible day trying to solve this issue:
    Cloudflare which has been recently integrated into my hosting platform insists on urls with WWW, and this has been fine across my website except for all of my downloadable products, which all have their respective URLs to their PDFs as https://ossiaeditions.com…
    This is no problem if they are to be downloaded directly, but I have them passing through a PDF Stamping plugin (WaterWoo), which isn’t working with the redirect somehow. I tried to reach support through them, but they are a 1 man team, and weren’t able to solve the issue. I want to simply change all of the download URLs, so I exported all my products and find-replace’d them all to have www in the title, but when I uploaded them on a staging site, it made it so every customer who had bought that PDF no longer has it in their past downloads (so they can’t redownload it at a future time, because it was no longer in their downloadable product permissions.

    Help! What options do I have apart from going and manually adding “www.” to 400 product URLs?

Viewing 4 replies - 1 through 4 (of 4 total)
  • (The one-woman team here.) If this helps, WaterWoo uses WooCommerce’s method parse_file_path() to tell if the $file_path (filterable in the ‘woocommerce_download_product_filepath’ hook) is local or remote.

    $parsed_file_path = WC_Download_Handler::parse_file_path( $file_path );
    if ( $parsed_file_path['remote_file'] === TRUE ) {
        echo __( 'The free version of WaterWoo cannot serve PDFs from remote servers.', 'waterwoo-pdf' ) . '<br />' 
        . __( 'Try uploading your PDF product to this domain using the native WooCommerce file uploader.', 'waterwoo-pdf' ); 
        if ( apply_filters( 'wwpdf_serve_unwatermarked_file', FALSE ) ) {
            return $file_path;
        } else {
            return;
        }
    }

    The $file_path sent to parse_file_path() is unadulterated from Woo’s download handler. So, why is parse_file_path() deciding the $file_path is now remote, is my question?

    Thread Starter chrisoko7

    (@chrisoko7)

    “One-woman team”**… my apologies! Yes I find it bizarre as well, what is the problem with the URL? What is the difference, as far as WaterWoo is concerned, between https://ossiaeditions.com/wp-content/uploads/woocommerce_uploads/(etc) and https://www.ossiaeditions.com/wp-content/uploads/woocommerce_uploads/(etc) ?

    No biggie. I’d just add in a line after line 71 wwpdf-file-handler.php

    $parsed_file_path = WC_Download_Handler::parse_file_path( $file_path );

    that says something like:

    var_dump($parsed_file_path);
    exit;

    and see what the file path looks like afterward.

    Plugin Support abwaita a11n

    (@abwaita)

    Hi @chrisoko7 ,

    There’s not been a follow-up in a while, so I’m marking this thread as resolved. Hopefully, you were able to find a solution to your problem!

    If you have further questions, please feel free to open a new topic.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘When importing updated product URLs via .CSV, customers lose product’ is closed to new replies.