craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
226 stars 170 forks source link

[3.x]: Sales not applied to products when added to cart or at checkout #2980

Closed okolvik-avento closed 1 year ago

okolvik-avento commented 2 years ago

What happened?

Description

Sales are working fine when prices are displayed on the product/product listing, but when it is added to the cart the price is the original price. This is also true when checking out. No sale information is stored in the snapshot image image image image image image image

{ "productId":"63675", "isDefault":"1", "price":449, "sortOrder":"1", "width":"0.0000", "height":"0.0000", "length":"0.0000", "weight":"0.0000", "stock":"0", "hasUnlimitedStock":"1", "minQty":null, "maxQty":null, "deletedWithProduct":false, "id":63676, "tempId":null, "draftId":null, "revisionId":null, "isProvisionalDraft":false, "uid":"76cff6f1-f5c3-4803-bf5f-920d63999d16", "siteSettingsId":108756, "fieldLayoutId":31, "contentId":80266, "enabled":true, "archived":false, "siteId":3, "title":"Hjertet i to : seks måneder med Karpe", "slug":null, "uri":null, "dateCreated":"2022-09-22T09:36:54+02:00", "dateUpdated":"2022-09-23T15:00:03+02:00", "dateLastMerged":null, "dateDeleted":null, "trashed":false, "isNewForSite":false, "canonicalId":63676, "ref":null, "status":"enabled", "structureId":null, "url":"https://xx.no/boker/sakprosa/hjertet-i-to?variant=63676", "isAvailable":true, "isPromotable":true, "shippingCategoryId":1, "sku":"9788234713538", "taxCategoryId":1, "product":{ "postDate":"2022-09-19T11:16:00+02:00", "expiryDate":null, "typeId":"1", "taxCategoryId":"1", "shippingCategoryId":"1", "promotable":"1", "freeShipping":"1", "availableForPurchase":"1", "defaultVariantId":"63676", "defaultSku":"9788234713538", "defaultPrice":"449.0000", "defaultHeight":"0.0000", "defaultLength":"0.0000", "defaultWidth":"0.0000", "defaultWeight":"0.0000", "taxCategory":null, "name":null, "id":63675, "tempId":null, "draftId":null, "revisionId":null, "isProvisionalDraft":false, "uid":"25290b11-a144-4864-a8f5-f09d9ea9db58", "siteSettingsId":108755, "fieldLayoutId":22, "contentId":80265, "enabled":true, "archived":false, "siteId":3, "title":"Hjertet i to : seks måneder med Karpe", "slug":"hjertet-i-to", "uri":"boker/sakprosa/hjertet-i-to", "dateCreated":"2022-09-22T09:36:54+02:00", "dateUpdated":"2022-09-23T15:00:03+02:00", "dateLastMerged":null, "dateDeleted":null, "trashed":false, "isNewForSite":false, "canonicalId":63675, "ref":null, "status":"live", "structureId":null, "url":"https://xx.no/boker/sakprosa/hjertet-i-to" }, "onSale":true, "cpEditUrl":"#", "description":"Hjertet i to : seks måneder med Karpe", "purchasableId":63676, "options":[], "sales":[] }

Expected behavior

Sale is added to cart and checkout.

Actual behavior

Sale is not added to cart or checkout

Craft CMS version

3.7.55 PRO

Craft Commerce version

3.4.17.2 PRO

nfourtythree commented 2 years ago

Hi @okolvik-avento

I have just tried to replicate this with a fresh install of Commerce 3.x and everything seems to be working as expected.

Here is an example: https://p191.p3.n0.cdn.getcloudapp.com/items/wbuQ68AO/6cfcd3d4-e6fe-4254-8e88-c4bf8793bbde.gif?v=32dfdc42b19b71c78b10dd2b567f0e98

Can you check to see if the product is set to be "Promotable" on the edit product page? It feels like there is something else at play here.

Thanks

okolvik-avento commented 2 years ago

Product is promotable. image

nfourtythree commented 2 years ago

HI @okolvik-avento

Do you have any other sales set up?

Are you able to replicate this issue with a fresh install and the example templates?

Thanks.

lukeholder commented 1 year ago

Can you check you don't have any discounts that are applying with this checkbox set in the discount:

CleanShot 2022-11-23 at 21 40 34@2x

This will remove sales from the item if a discount is being applied to it.

lukeholder commented 1 year ago

Closing this. Can reopen once we get a response from @okolvik-avento Thanks!