1

In Magento 2, how can I update the PDF file of a download product so that old links refers to the new PDF?

I think there are 2 ways to try that:

  1. I can load every links (in this case THE link) of the product and delete them and set the new one. I think it will not be a problem for purchased links in the past because the link interfaces refer to the product sku by this save function:

    $link_repository->save($sku, $link_interface); 
    

    The product will not be deleted and will conserve its old sku, so the links will be actualized with a new one (right...?).

  2. I can try to change the base64 encoded content of the Link used to set the Link to the product:

    $content_interface->setFileData($b64pdf);
    

Any idea?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.