Commit Graph

1493 Commits

Author SHA1 Message Date
Claudio Sanches d7e2a98aaf
Merge pull request #24828 from woocommerce/fix/24695
Adds shared code between Orders and Cart calculation logic.
2019-12-05 12:39:50 -03:00
Claudio Sanches 0686e6f1cd
Merge pull request #25000 from woocommerce/feature/pay-button-support
Initial support for "pay button"
2019-12-04 16:02:02 -03:00
Rodrigo Primo 4af9a94129 PHPCS fixes 2019-12-04 15:52:20 -03:00
Claudio Sanches adbb4fd2d3
Merge pull request #24937 from jenkoian/wc-placeholder-attrs
Add support for custom attributes to wc_placeholder_img().
2019-12-04 15:42:41 -03:00
Rodrigo Primo 02ae8d1206
Merge pull request #24292 from woocommerce/fix/24116
Prevent PHP notices in WooCommerce widgets using Gutenberg's Legacy Widget Block
2019-12-03 14:25:05 -03:00
vedanshujain aaa85ac74c Use standard way to calculate total in `get_subtotal_to_display` for consistency.
We were calculating subtotal to display slightly differently then we would have calculated subtotal in the cart. This was affecting subtotal value in invoices and in order confirmation screen.

This patch updates how we calculate subtotal to display such that we calculate in same way.
2019-11-27 04:43:23 +05:30
vedanshujain 1de30e8963 Refactor so that trait don't have class specific functions. 2019-11-26 01:30:45 +05:30
vedanshujain 60cd7b3651 Refactor Order Class to use shared calculation logic.
We added a trait to move shared logic betweem Orders and Cart. This commit refactors Order class to use that shared logic.
Also adds a test for a failing case.
2019-11-25 17:53:14 +05:30
vedanshujain bee7ea4490 Add trait which contains common total calc logic.
`WC_Abstract_Order` and `WC_Cart_Totals` have their own logic to calculate totals. This means that we would have to fix in two places. This commit adds a trait which can be used to place shared logic between above two classes.
2019-11-25 17:53:14 +05:30
Claudio Sanches d53b73b56c Added support for "pay button" feature 2019-11-07 17:22:33 -03:00
Ian Jenkins 2340f269cf Add support for custom attributes to wc_placeholder_img().
When displaying a list of images you often want a specific class to be
attached to each image, therefore you pass through a custom class using
the attr parameter. Unfortunately this doesn't get passed through to a
placeholder image should one be needed. This means that, for example, if
you're custom class center an image or something, it won't be honoured
for placeholders, which can lead to some wonky image listings.

You can work around this currently by leverging the
`woocommerce_product_get_image` filter, but it's a bit gnarly as you
need to do some regexing or string splitting or something and checking
class names and what not. This provides a much easier way, by
supporting custom attrs on placeholder images as is the case for non
placehodler images.
2019-10-30 15:08:19 +00:00
Gerhard Potgieter c01a0916c3
Merge pull request #24559 from itzmekhokan/fix/24458
Fix backordered product missing backordered label on frontend
2019-10-02 15:28:26 +02:00
Vedanshu Jain 9641963001
Merge pull request #24740 from woocommerce/feature/24654
Make WC_Abstract_Order::recalculate_coupons() public
2019-10-02 15:56:36 +05:30
Vedanshu Jain 2188f9b788
Merge pull request #24341 from woocommerce/fix/24238
Check for max discount to be -ve to prevent overwriting fee.
2019-10-02 14:32:15 +05:30
Claudio Sanches 8c88cd9b6f Make WC_Abstract_Order::recalculate_coupons() public 2019-10-01 17:19:33 -03:00
Rodrigo Primo 4550bb6661
Merge pull request #24544 from woocommerce/fix/checkout-permalink
Prefer wc_get_checkout_url() instead of wc_get_page_permalink( 'checkout' )
2019-09-25 20:38:38 -03:00
Ayesh Karunaratne eec96d367c
Fix a typo in WC Payment Gateway abstract '3rd party gateway size' 2019-09-18 10:22:16 +05:30
vedanshujain 6f2d64dcb4 Check for max discount to be -ve to prevent overwriting fee.
When we refund fee and some other line item whose value is more than fee in a single requst, value of line item will overwrite refund fee.

This is because where we check to make sure that we do not discount more than total possible value (to prevent negative total), we do not account for the fact that sometimes the cart could contain refund items. In those cases max_discount * -1 will always be larges then fees total.

This commit adds a check to make sure that max discount * -1 is indeed negative before overwriting fee total.
2019-09-03 20:45:33 +05:30
itzmekhokan dcf3d71c79 Fixed issue #24458 2019-09-02 12:40:44 +05:30
Claudio Sanches e814105728 Prefer wc_get_checkout_url() instead of wc_get_page_permalink( 'checkout' ) 2019-08-30 13:06:50 -03:00
Claudio Sanches 78c5a37b4b Prevent PHP notices in WooCommerce widgets using Gutenberg's Legacy Widget Block 2019-08-01 14:43:59 -03:00
Gerhard Potgieter 52f1eb4060
Revert "Prevent negative prices on products" 2019-07-15 08:50:11 +02:00
Claudio Sanches 77191a97f8
Merge pull request #23705 from woocommerce/fix/23696
Prevent negative prices on products
2019-07-12 12:56:34 -03:00
Mike Jolley c928188831 Update from master 2019-07-10 12:57:02 +01:00
Claudio Sanches 01f5a09d27
Merge pull request #23338 from woocommerce/update/23335
More useful actions in during CRUD save events
2019-07-08 18:56:14 -03:00
Claudio Sanches deec93f8ca
Merge pull request #23769 from mch0lic/master
Forward query (GET) parameters when executing a batch REST API request.
2019-06-24 12:39:36 -03:00
Mike Jolley 950f31a9e0 Remove abstract rest class that is in the package 2019-06-21 13:40:10 +01:00
Mike Jolley 7451659b24 Delete REST API abstract classes 2019-06-19 11:49:28 +01:00
Jared Burke 332c94c13a Fix fatal error when applying a virtual coupon to an order placed by a guest 2019-06-06 15:37:08 -05:00
Ajay Ghaghretiya c9bcce3a31 #23850 Fixed the coupon usage limit issue when apply coupon from admin panel (#23851)
* fix the coupon usage limit issue

* fix the if condition for the usage limit

* fixed coding standard

* fix the if conditions for coupon usage limit per user
2019-06-03 10:47:32 -03:00
Gerhard Potgieter b2ed079520 Manual orders coupon usage limits by email (#23775)
* Add functionality to wp-admin order to check for coupon usage based on email addresses, similar to how WC_Cart handles this seperately, included unit tests.

* Only do the coupon by email usage check if order is from a guest. Fix issue with unit test.
2019-05-27 11:45:29 -03:00
Claudio Sanches 28d49031d3
Merge pull request #23695 from james-allan/calc-base-zip-city
Calculate base store taxes including the store's zip and city
2019-05-22 20:49:57 -03:00
sergey.r 98586f10f4 Catch WC_REST_Exception while calling do_action( "woocommerce_rest_insert_{$this->post_type}_object" 2019-05-22 13:00:34 +03:00
Mindaugas Budreika d67381148a Forward query (GET) parameters when executing a batch REST API request. 2019-05-20 14:24:48 +04:00
Boris Djemrovski c45e06a130 get_formatted_line_subtotal takes Item object instead of an array 2019-05-16 12:04:34 +02:00
Gerhard Potgieter 30ce9ff6a3
Merge pull request #23689 from woocommerce/add/get_used_coupon_codes
Deprecate get_used_coupons in favor of get_coupon_codes
2019-05-15 15:34:40 +02:00
James Allan 6069854d9f Replace wc_get_base_location() with individual getters 2019-05-15 15:43:15 +10:00
Claudio Sanches b68b35336f Prevent negative prices for products 2019-05-14 13:22:06 -03:00
Gerhard Potgieter b7facc0674
Merge pull request #23663 from danielbitzer/add_get_coupons_method
Add WC_Abstract_Order::get_coupons()
2019-05-14 11:35:21 +02:00
Gerhard efe3e4c5d6 Move get_used_coupons to WC_Abstract_Legacy_Order and renamed get_used_coupon_codes to get_coupon_codes. 2019-05-14 11:19:48 +02:00
Daniel Bitzer 0705730121 Add WC_Abstract_Order::get_coupons() 2019-05-14 15:46:48 +09:30
James Allan 45b461639e Calculate base store taxes including the store's zip and city 2019-05-14 13:43:57 +10:00
Gerhard 31acfbcb4a Deprecate WC_Abstract_Order::get_used_coupons in favor of WC_Abstract_Order::get_used_coupon_codes, this reflects the actual data being returned better. 2019-05-13 14:40:54 +02:00
Nathan Dawson 6088f7c353 Fixes #23578 - Check taxes are enabled before adding totals row to orders 2019-05-01 22:05:46 +01:00
Mike Jolley 47eee0143f Restore order note on exception 2019-04-17 13:07:52 +01:00
Mike Jolley a0d4f6174c Consistent CRUD classes with before/after save hooks 2019-04-17 12:47:35 +01:00
Timmy Crawford e1c09b4609
Merge pull request #22973 from woocommerce/update/22545
Revised sale start/end date save logic
2019-03-14 17:53:40 -07:00
Mike Jolley cd92c68476 fix offset check 2019-03-11 15:00:42 +00:00
Mike Jolley c56d3ede9f Remove day offsets 2019-03-08 13:35:30 +00:00
Mike Jolley 76fabc9b7e
Merge pull request #22771 from martinsnajdr/flatrate-shipping-cost-filters
Shipping method get_option function filters
2019-03-04 13:49:22 +00:00