Easy-digital-downloads: "Show Privacy Policy" text link is positioned in between "Show Terms" and "Agree to Terms" checkbox

Created on 8 Nov 2018  路  10Comments  路  Source: easydigitaldownloads/easy-digital-downloads

Bug Report

Expected behavior

When I enable the Agree to Terms option, and I also enable the Show the Privacy Policy on checkout option, I expect the EDD checkout to first display the Show Terms link (to expand the terms), followed by Agree to Terms? checkbox and text. Underneath that, I expect to see the Show Privacy Policy link to expand the privacy policy.

This is how I expect it to look (I've modified the HTML source):

screen shot 2018-11-08 at 2 35 48 pm

I expect the above because if I _also_ enable the Agree to Privacy Policy option, EDD checkout correctly shows me each text link followed by its relevant checkbox option:

screen shot 2018-11-08 at 2 26 25 pm

Actual behavior

The Show Privacy Policy text link is positioned in between Show Terms and the Agree to Terms checkbox:

screen shot 2018-11-08 at 2 24 37 pm

Steps to reproduce the behavior

1) Enable Show the Privacy Policy on checkout

<img width="1002" alt="screen shot 2018-11-08 at 2 29 59 pm" src="https://user-images.githubusercontent.com/52581/48171933-cc60db80-e362-11e8-8656-296a56bd5b87.png">

2) Enable Agree to Terms

<img width="1079" alt="screen shot 2018-11-08 at 2 30 47 pm" src="https://user-images.githubusercontent.com/52581/48171968-ebf80400-e362-11e8-87c1-fdbe6f9795cc.png">

3) Visit EDD checkout and scroll to bottom:

screen shot 2018-11-08 at 2 24 37 pm

component-checkout priority-high type-bug

All 10 comments

This is ready for testing, which will require test purchases with multiple configurations. It's simpler than it looks, I promise.

This PR takes care of this issue as well as https://github.com/easydigitaldownloads/easy-digital-downloads/issues/6598.

Pre-config steps:

  • Checkout branch issue/7027.
  • In a tab, open up: /wp-admin/edit.php?post_type=download&page=edd-settings&tab=misc&section=site_terms
  • In another tab, open up: /wp-admin/edit.php?post_type=download&page=edd-settings&tab=privacy
  • Uncheck all checkboxes and empty all text fields and textareas. You should have totally blank settings on both pages.Now using the settings on those two pages, please perform a test purchase with the following steps:

  1. With all settings unchecked/empty, complete a purchase. This should result in no relevant checkboxes/terms/policies on checkout, and a successful purchase process.

  2. CHECK _Agree to Terms_ and visit checkout with a product in the cart. This should result in just a checkbox and the default label on checkout for the terms agreement. Attempt to purchase without checking the box to verify the checkout error. Now check the box and complete your purchase. Keep in mind that with this PR, the expandable _Agreement Text_ output is now gone, since it's empty. The label itself supports anchor tags, so users should be able to link to a terms page and not use the Agreement Text (by leaving it blank).

  3. ADD Agree to Terms Label Try this: Agree to terms: <a target="_blank" href="https://google.com">Link</a>. Visit checkout with a product and verify that there is a checkbox and a custom label, now with a link that works without actually checking the checkbox when you click it. Now check the box and complete your purchase.

  4. ADD Agreement Text and visit checkout with a product in the cart. Verify that you see the checkbox, label, and an expandable/collapsible container above that displays your new Agreement Text. Check the box and complete your purchase.

  5. UNCHECK the _Agree to Terms_ setting, which will completely remove all terms output from the checkout. We are done with terms for now. Move over to the Privacy Policy settings page.

  6. CHECK _Agree to Privacy Policy_ setting and visit checkout with a product in the cart. This should result in just a checkbox and the default label on checkout for the privacy policy. Attempt to purchase without checking the box to verify the checkout error. Now check the box and complete your purchase. Keep in mind that this setting has never required you to actually display privacy policy text, which leads us to the next setting.

  7. UNCHECK _Agree to Privacy Policy_ setting and CHECK _Show the Privacy Policy on checkout_ setting. Unlike terms agreement functionality, the privacy policy output can be displayed on checkout without requiring the customer to agree to it. Visit checkout with a product in the cart and verify only an expandable/collapsible container displays, which holds the privacy policy content. This content is pulled from the WP core setting the privacy page. So, you won't see this container at all if:

  8. your WP core privacy page is not set
  9. the WP core privacy page you selected has no post_content
    With the above conditions verified and met, complete your purchase.

  10. LEAVE _Show the Privacy Policy on checkout_ setting checked, CHECK _Agree to Privacy Policy_ setting, and ADD Agree to Privacy Policy Label Try this: Agree to policy: <a target="_blank" href="https://google.com">Link</a>. Visit checkout with a product and verify that there is a checkbox, a custom label with a link that works without actually checking the checkbox when you click it, and an expandable/collapsible container holding the privacy policy. Now check the box and complete your purchase.

  11. Finally, just to be super safe, UNCHECK all checkboxes on both settings pages (leave the values in text fields and textareas). Visit checkout with a product in the cart and verify that no relevant output shows up for either set of settings. Complete your purchase.

Das it mane.

I've also verified that everything works on a fresh install without touching any of the Terms Agreement or Privacy Policy settings.

@SDavisMedia tested all 9 steps and everything worked as expected with issue/7027 loaded.

Oh... almost forgot this specific issue. 馃槤

  1. CHECK _Agree to Terms_ setting to show any configuration of terms on checkout, and for Privacy Policy CHECK _Show the Privacy Policy on checkout_ (but leave _Agree to Privacy Policy_ unchecked). That gives you the scenario reported in this issue. The expected result is Privacy Policy output _NOT_ mixed up inside of the terms output (which is impossible now anyway since the code no longer lives there).

@SDavisMedia confirmed the impossible didn't happen. :)

In other words, confirmed 10 worked as expected.

LOL thanks!

@SDavisMedia @dgoldak I tested all steps listed above and confirmed everything works as expected. Nice work @SDavisMedia

I'll be testing later today.

@SDavisMedia I've just walked through the testing instructions and everything worked perfectly!

This is a _great_ example of how PRs and testing should be done on anything that affects checkout.

I have requested a couple of tiny changes on the PR for some improper indention, but otherwise this is ready to go!

@dgoldak @mintplugins @pippinsplugins Merged. Thanks for testing!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DevinWalker picture DevinWalker  路  6Comments

zackkatz picture zackkatz  路  4Comments

JeroenSormani picture JeroenSormani  路  5Comments

davidsherlock picture davidsherlock  路  4Comments

boluda picture boluda  路  4Comments