RobertSpread / spreadcart

simple plugin to display a cart for the spreadshop everywhere on your domain
1 stars 1 forks source link

Shopping cart does not reflect elected discount #24

Open jtlapp opened 8 years ago

jtlapp commented 8 years ago

I don't know if this is a spreadCart problem or a problem at Spreadshirt. When I elected the 15% discount via the drop-down box in the SpreadShop header, the header changes to "Code Active." However, I do not see 15% discount being reflected anywhere. Reloading the page does not put it in the shopping cart. It is not showing in the XML returned via the API. And when I go to checkout, it is not shown there. In fact, at checkout, I have to find the sneaky little "redeem coupon" link to redeem activate the supposedly-active coupon.

I had a customer this week complain that they did not get the free shipping that they claimed via the SpreadShop header. They did so through my web site, so I don't know where the problem lies.

jtlapp commented 8 years ago

In the XML, the priceItem element is supposed to give the price without discount, while the price element is supposed to give the price with discount, according to the API documentation. The two elements are identical.

RobertSpread commented 8 years ago

The coupon is, to my knowledge, only applied to the cart in the checkout. I will check with the checkout team but am afraid, that there is not much we can do.

jtlapp commented 8 years ago

If that's so, the "Code Active" header is lying to us! =)

RobertSpread commented 8 years ago

The "header" hands over the coupon to the checkout as URL parameter. In the checkout the coupon is then automatically applied. According to my newest research ( ;) ), the application of the coupon code via API is possible whe you call the basket/coupon ressource. The shop currently does not aply it for reasons of validating the coupon, performance and other magic. We can decide if we want to do it as the shop does or if we want to apply the coupon directly. Then we would need to listen to the click on the "apply coupon" button and trigger a basket update. We would also need to rewrite the localStorage to get this done. So it will be a little time consuming.

I can check the options and provide a mock if you like.

jtlapp commented 8 years ago

Wow. That's awesome information. Thank you!

jtlapp commented 8 years ago

You say, "The shop currently does not aply it," but SpreadShop is claiming to apply it. I guess in order for spreadCart to apply a coupon registered through SpreadShop, we're going to need to read it from SpreadShop. Otherwise I'll have to shut off this header and provide my own announcement of any discounts.

RobertSpread commented 8 years ago

Well, I hope we do not get lost in translation. The shop hands over the coupon code to the checkout and there it is applied (the recalculation of the basket total happens then). Therefore I stated, that the shop does not apply it.

In case you have not seen my edit of the previous comment:


We can decide if we want to do it as the shop does or if we want to apply the coupon directly. Then we would need to listen to the click on the "apply coupon" button and trigger a basket update. We would also need to rewrite the localStorage to get this done. So it will be a little time consuming.

I can check the options and provide a mock if you like.


jtlapp commented 8 years ago

Hah! Big letters! Okay, reading again, I see what you mean. SpreadShop receives it but nothing applies the code until checkout, so it wouldn't be available to the API.

jtlapp commented 8 years ago

Or rather, the discounts wouldn't show in the XML returned by the shopping cart API.

RobertSpread commented 8 years ago

Big letters was an accident..... Strange markup here ;)

RobertSpread commented 8 years ago

I will create a branch and build a mock over the weekend so we can review it together.

jtlapp commented 8 years ago

SpreadShop is getting the discount description and code from this URL on my shop: http://shop.spreadshirt.com/shopData/jopodia/core?locale=us_US&version=2.24.1_e74b5669b296381257880e656e6cdb8b26bd860b

The checkout URL includes a "couponCode" parameter to indicate the code.

Also, I noticed an "emptyBasketUrl" that checkout might use after successful checkout.

TWDesigns commented 8 years ago

I replied on the SS forums before finding this topic but I too am having the same issue. Is there a way to resolve? If not I will hide the drop down that Spreadshop adds to suggest you use the coupon and just force users to manually click the Apply Coupon link.

Thanks!

jtlapp commented 8 years ago

We have not yet moved a solution into the master branch. I believe the solution will require that you enter the discount code into spreadcart anyway, and not into anything that SpreadShop provides, so you'd be hiding the SpreadShop coupon links anyway. I plan to look into this soon.

RobertSpread commented 8 years ago

I reserved some time tomorrow to work on it and to review the status! Maybe there is a quick solution. But nothing I can guarantee right now.