Download & Extend

Can't get coupons to work with PayPal Express Checkout

Project:Ubercart Discount Coupons
Version:6.x-1.1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I'm using PayPal Express Checkout in Ubercart and I've noticed it doesn't give me the option to enter a coupon because with PayPal Express Checkout the user doesn't go to the Ubercart checkout page. Is this correct? If so maybe there should be a coupon pane on the cart page just like "shipping quote".

Comments

#1

Category:support request» feature request

PayPal Express Checkout uses its own checkout page instead of the standard panes. It should be possible to add coupon support here, but I currently don't need this functionality.

#2

Status:active» postponed

#3

Version:5.x-1.5» 6.x-1.1
Status:postponed» needs work

This patch is meeting my needs to get coupons working while using Google Checkout. Google Checkout doesn't use the checkout screen either so the coupons are used on the cart screen.

AttachmentSize
cart-coupon.patch 2.84 KB

#4

Thank you for submitting this patch, this looks good! It does need a little work, for example the uc_coupon_form_alter() function apparently does nothing, but I will run some tests and try to commit this feature soon.

#5

Status:needs work» fixed

Committed with a few small changes; I moved the hook_uc_cart_alter() code to hook_uc_order() and added the coupon as a line item rather than modifying the product prices directly. The coupon cart pane can also be used if the checkout is enabled, the coupon code is immediately applied on the checkout screen in this case.

Thanks again for your work on this!

#6

Status:fixed» needs work

While the patch now in HEAD does properly display the coupon code text box and messages on the cart page if you use it with google checkout it fails to modify the order before sending the user on to Google checkout so the coupon is never actually applied and the user is asked to pay full price.

Also, it seems like the order amount on the cart pane should be decremented when the coupon is applied rather than just displaying the message that the coupon has been applied. This behavior is somewhat counter intuitive.

#7

Status:needs work» fixed

I thought Google Checkout worked similarly to PayPal EC, but there is no way of passing a modified order total or discount line item to Google Checkout - the only information that is sent is a list of products and shipping options. Google Checkout does support the use of coupons entered in Google's own pages, but Ubercart does not implement the Merchant Calculations API needed for this, and there is no way uc_coupon can currently hook into uc_google_checkout to make this work.

To use coupons with Google Checkout for now I think you will have to set them up in Google Checkout itself - see https://sandbox.google.com/checkout/sell/settings?section=Coupons for the sandbox version of this. Unfortunately this is nowhere near as flexible as uc_coupon. If you can see a workaround for this please let me know!

As for the cart pane not updating with the new price, the cart pane doesn't have any way of displaying line items - it can only list cart products and their subtotal. This is unfortunate but again I can't see a way around this. Maybe it could display the coupon value somewhere in the coupon pane, similar to the way the shipping quote estimate works?

This issue was originally for PayPal Express Checkout, which I believe to be fixed. Please open a new issue to continue discussing these two feature requests.

#8

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#9

I know this is both old and closed, and I just went through this problem.

The now tells us to create extra line items and send a negative value for a discount.

I don't yet know the proper way to do drupal mods, but I edited the Google Checkout modual function uc_google_checkout_cart_form_submit(), to call uc_discounts_get_discount_amount_for_order("review"). I then took the abs of that, added it to the order array.

Then in uc_google_checkout_cart_request, I added some logic to check for the discount value, and write a new item like this:

     if ($order->discount_total < 0) {
      $output .= '<item>';
      $output .= '<item-name>Generic Discount</item-name>';
      $output .= '<item-description>This is a generic discount item.</item-description>';
      $output .= '<unit-price currency="USD">'.$order->discount_total.'</unit-price>';
      $output .= '<quantity>1</quantity>';
      $output .= '</item>';
    }

#10

Subscribing