bigcommerce-api-php icon indicating copy to clipboard operation
bigcommerce-api-php copied to clipboard

updateResource causing order total to be overwritten if coupon is applied

Open tomascordero opened this issue 8 years ago • 0 comments

This is the example code I am using to update the resource. Im not passing any info about the total/subtotal. It should just update the passed in fields and not touch any other fields. $_order = new \Stdclass; $_order->billing_address = new \StdClass; $_order->billing_address->street_1 = $data['billing_address_street_1']; $_order->billing_address->street_2 = $data['billing_address_street_2']; $_order->billing_address->city = $data['billing_address_city']; $_order->billing_address->state = $data['billing_address_state']; $_order->billing_address->zip = $data['billing_address_zip']; Bigcommerce::updateResource('/orders/' . $order->id, $_order);

What is actually happening, and it seems to be the case whenever I update billing info using updateResource, is that the order total gets overwritten if the order has a coupon code applied to it. I tested it a few times one by passing in a straight array and another by passing in the object. However I did find it interesting that if I go to edit the order in bigcommerce I can actually see the applied coupon on the final order edit page. Once I click save the total is updated to reflect the coupon.

To recreate this problem I create an order using a coupon code. This can be done in both the admin side or the front end store side. Then using the updateResource function I just pass in parameters like so: Bigcommerce::updateResource('/orders/' . $order->id, array( 'billing_address' => $_order->billing_address, 'staff_notes' => $_order->staff_notes));

tomascordero avatar Jul 20 '17 23:07 tomascordero