Order discounts are working fine, but product discounts do not. The website is using Commerce Product Attributes, and I think it has something to do with the fact that the product is actually $0. The attributes are getting assigned prices. When I enter a coupon code, the discount is applied as a $0.00 discount because it is calculating a percentage off of the product (which it thinks is $0.00). Then it sets the product price to $0.00 as well. When I reload the page, the discount disappears.

Comments

Mirakolous created an issue. See original summary.

joelpittet’s picture

Status: Needs work » Active

Please add more details on your setup and 'Needs Work' status is for when you've reviewed a patch that needs work, the status should be 'Active' Details here: https://www.drupal.org/node/156119#needs-work

mirakolous’s picture

Status: Active » Needs review
StatusFileSize
new1.49 KB

I have a temporary fix here (I am sure there is a better solution). With this patch, I am basically just reloading the wrapper by loading the wrapper from the previous wrapper's ID. Then I set the older wrapper's field 'commerce_unit_price' with the reloaded wrapper's value from that field (which is the correct value).

joelpittet’s picture

Thanks for the patch @Mirakolous.

What is this addition serving?
$info = $wrapper->getPropertyInfo()

joelpittet’s picture

Issue tags: +Needs tests

If we have reproducible steps it may be worth adding some simple tests if this fixes it (or something like this).

mirakolous’s picture

@joelpittet Good catch I am updating the patch to remove that. I will try to reproduce on vanilla D7 site this weekend.

Status: Needs review » Needs work

The last submitted patch, 6: commerce_discount-product-discount-amount-2847475-6-7.patch, failed testing.

mirakolous’s picture

As far as this issue goes, I tried installing a fresh D7 commerce site along with the product attributes module. It is clear to me that this will take hours just to get all of the modules configured properly for testing, and I do not have the time for that right now. I guess we should just call this an edge case for right now.

mirakolous’s picture

Status: Needs work » Closed (cannot reproduce)
joelpittet’s picture

Status: Closed (cannot reproduce) » Needs work

The test failure is just because the patch isn't relative to the project's root. You can use --relative on the git diff, or remove the excess parts of the paths manually in the patch.

joelpittet’s picture

Status: Needs work » Closed (cannot reproduce)

Ah ok, leaving this closed, thanks for the update.

avpaderno’s picture

Assigned: mirakolous » Unassigned
Issue tags: -Product discount, -Commerce product attributes, -product attributes +Discount