Skip to content

Conversation

@CaldwellYSR
Copy link
Contributor

Create a new setting option for inline file delivery for downloadable
products. In the Download Handler create a new method for the new
setting as well as a method for returning the proper headers to deliver
files inline.

Resolves: #28410

All Submissions:

Changes proposed in this Pull Request:

Creates a new setting for allowing downloadable product files to be delivered inline so they would open directly in the browser. This would be useful for stores selling HTML or PDF files so customers can access them directly without the need to download.

Only other change was aligning => signs in an array to match WordPress indentation coding standards.

Closes #28410 .

How to test the changes in this Pull Request:

  1. Create a downloadable/virtual product.
  2. From Woocommerce Settings > Products > Downloadable Products select Inline File Delivery
  3. Create a test purchase of the downloadable product
  4. Test download delivery

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

Base automatically changed from master to trunk February 25, 2021 22:18
claudiosanches and others added 2 commits March 19, 2021 12:40
…recalculate

Update the tax rate meta when recalculating and updating order tax items
Create a new setting option for inline file delivery for downloadable
products. In the Download Handler create a new method for the new
setting as well as a method for returning the proper headers to deliver
files inline.

Resolves: woocommerce#28410
@CaldwellYSR CaldwellYSR force-pushed the allow-inline-downloads branch from 1e11fdc to 814fc8b Compare April 6, 2021 12:08
@CaldwellYSR
Copy link
Contributor Author

Not sure what happened with the 4 commits. I only authored two commits. Any progress on this would be greatly appreciated. It's been working on our site for a while now but it's technical debt to keep having to apply this update every time we need to update the plugin.

@vedanshujain vedanshujain requested review from a team and vedanshujain and removed request for a team April 21, 2021 06:28
Copy link
Contributor

@vedanshujain vedanshujain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add this as a setting actually instead of a separate download method, since it can be used with X-Accel-Redirect as well, and not just with force downloads.

We can then pass the value of this setting to download_headers and set the Content-Disposition header appropriately based on the params. That way, we won't have to create (and maintain) another download method, and another download header function. What do you think?

Since inline-delivery works with multiple download methods
@CaldwellYSR
Copy link
Contributor Author

CaldwellYSR commented Jul 16, 2021

Let's add this as a setting actually instead of a separate download method, since it can be used with X-Accel-Redirect as well, and not just with force downloads.

We can then pass the value of this setting to download_headers and set the Content-Disposition header appropriately based on the params. That way, we won't have to create (and maintain) another download method, and another download header function. What do you think?

@vedanshujain I agree with your suggestion and have made that change with the commit 386d75b

@CaldwellYSR
Copy link
Contributor Author

@vedanshujain Any more suggestions for moving this forward?

@CaldwellYSR
Copy link
Contributor Author

@vedanshujain I have been using this change for a while now and would love to get it merged into master so that I don't have to keep making the change every woocommerce update. Anything I can do or change to move this forward?

Copy link
Contributor

@vedanshujain vedanshujain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I accidentally unfollowed this thread and missed pings, sorry. I have left couple more comments, but I can take care of them myself as well, given that it has been a lot of time since the first round of review.

'desc' => __( 'Deliver downloadable files inline', 'woocommerce' ),
'id' => 'woocommerce_downloads_deliver_inline',
'type' => 'checkbox',
'default' => 'yes',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be disabled to false to keep the current behavior as it.

}
}

private static function get_content_disposition() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is missing doc comments.

continue;
}
$saved_rate_ids[] = $tax->get_rate_id();
$tax->set_rate( $tax->get_rate_id() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unintended change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely unintended. Not sure where it came from apologies.

@CaldwellYSR
Copy link
Contributor Author

@vedanshujain I don't believe my fork is rebased to the upstream but I made the commented changes.

@vedanshujain
Copy link
Contributor

I don't believe my fork is rebased to the upstream but I made the commented changes.

No worries, I can take care of rebasing. Thanks for the patience, code looks fine, I am planning to do some more tests tomorrow before merging.

@CaldwellYSR
Copy link
Contributor Author

I don't believe my fork is rebased to the upstream but I made the commented changes.

No worries, I can take care of rebasing. Thanks for the patience, code looks fine, I am planning to do some more tests tomorrow before merging.

Happy to hear it. Thanks again.

@vedanshujain
Copy link
Contributor

Closing in favor of #31145 (rebased from trunk).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloadable Products -- Inline file delivery

4 participants