awesomemotive / easy-digital-downloads

Sell digital downloads through WordPress
https://easydigitaldownloads.com
GNU General Public License v2.0
864 stars 475 forks source link

Cannot use buy now to purchase multiple price options at once #5018

Open chriscct7 opened 7 years ago

chriscct7 commented 7 years ago

Make a download with buy it now and multiple variation purchase enabled.

Make 2 variations, 1 priced 10, and 1 priced 11.

Attempt to buy it now on both. Instead of getting total of 21, you get total of 10. Haven't tested yet with quantities but doubt it will be different total if you do

1 * 10 + 2 * 11 2 * 10 + 1 * 11 2 * 10 + 2* 11

because there doesn't appear to be quantity handling.

Caused by https://github.com/easydigitaldownloads/easy-digital-downloads/blob/64d11791d42897a8b0b3da62ecf071baf91feec6/includes/gateways/functions.php#L211 taking the default price option and ignoring the second.

Related #5000

chriscct7 commented 7 years ago

image

is the result of trying to buy it now both the 10 and 11 variations

pippinsplugins commented 7 years ago

I don't believe this is related to #5000 but will dig more.

chriscct7 commented 7 years ago

Pretty sure its related, caused by https://github.com/easydigitaldownloads/easy-digital-downloads/blob/64d11791d42897a8b0b3da62ecf071baf91feec6/includes/gateways/functions.php#L211

That will get the default price ID's amount, which if you notice at hte bottom is saved here as price_id[0]['amount'] https://github.com/easydigitaldownloads/easy-digital-downloads/blob/64d11791d42897a8b0b3da62ecf071baf91feec6/includes/gateways/functions.php#L228.

Because the key doesn't exist, per #5000, it will override the same key for all products (working theory)

pippinsplugins commented 7 years ago

We've intentionally not supported multiple price options with Buy Now buttons before. I've updated the issue title to better reflect the bug.

This is not an urgent bug so punting out of 2.6.9.

robincornett commented 2 years ago

I just ran into something related to this today trying to replicate an issue. Right now, if the multi-option purchase is enabled for a download, EDD still allows the buy now button to load (for whatever gateway).

The edd_get_purchase_link function overrides the buy now button parameter if the shop doesn't support buy now for some reason. It seems like adding a check there for the multi-purchase option mode would be worth doing.