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.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / legacy / class-wc-legacy-cart.php
woocommerce / includes / legacy Last commit date
abstract-wc-legacy-order.php 1 year ago abstract-wc-legacy-payment-token.php 5 years ago abstract-wc-legacy-product.php 1 year ago class-wc-legacy-cart.php 3 years ago class-wc-legacy-coupon.php 5 years ago class-wc-legacy-customer.php 5 years ago class-wc-legacy-shipping-zone.php 5 years ago class-wc-legacy-webhook.php 5 years ago
class-wc-legacy-cart.php
448 lines
1 <?php
2 /**
3 * Legacy cart
4 *
5 * Legacy and deprecated functions are here to keep the WC_Cart class clean.
6 * This class will be removed in future versions.
7 *
8 * @version 3.2.0
9 * @package WooCommerce\Classes
10 * @category Class
11 * @author Automattic
12 */
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * Legacy cart class.
20 */
21 #[AllowDynamicProperties]
22 abstract class WC_Legacy_Cart {
23
24 /**
25 * Array of defaults. Not used since 3.2.
26 *
27 * @deprecated 3.2.0
28 */
29 public $cart_session_data = array(
30 'cart_contents_total' => 0,
31 'total' => 0,
32 'subtotal' => 0,
33 'subtotal_ex_tax' => 0,
34 'tax_total' => 0,
35 'taxes' => array(),
36 'shipping_taxes' => array(),
37 'discount_cart' => 0,
38 'discount_cart_tax' => 0,
39 'shipping_total' => 0,
40 'shipping_tax_total' => 0,
41 'coupon_discount_amounts' => array(),
42 'coupon_discount_tax_amounts' => array(),
43 'fee_total' => 0,
44 'fees' => array(),
45 );
46
47 /**
48 * Contains an array of coupon usage counts after they have been applied.
49 *
50 * @deprecated 3.2.0
51 * @var array
52 */
53 public $coupon_applied_count = array();
54
55 /**
56 * Map legacy variables.
57 *
58 * @param string $name Property name.
59 * @param mixed $value Value to set.
60 */
61 public function __isset( $name ) {
62 $legacy_keys = array_merge(
63 array(
64 'dp',
65 'prices_include_tax',
66 'round_at_subtotal',
67 'cart_contents_total',
68 'total',
69 'subtotal',
70 'subtotal_ex_tax',
71 'tax_total',
72 'fee_total',
73 'discount_cart',
74 'discount_cart_tax',
75 'shipping_total',
76 'shipping_tax_total',
77 'display_totals_ex_tax',
78 'display_cart_ex_tax',
79 'cart_contents_weight',
80 'cart_contents_count',
81 'coupons',
82 'taxes',
83 'shipping_taxes',
84 'coupon_discount_amounts',
85 'coupon_discount_tax_amounts',
86 'fees',
87 'tax',
88 'discount_total',
89 'tax_display_cart',
90 ),
91 is_array( $this->cart_session_data ) ? array_keys( $this->cart_session_data ) : array()
92 );
93
94 if ( in_array( $name, $legacy_keys, true ) ) {
95 return true;
96 }
97
98 return false;
99 }
100
101 /**
102 * Magic getters.
103 *
104 * If you add/remove cases here please update $legacy_keys in __isset accordingly.
105 *
106 * @param string $name Property name.
107 * @return mixed
108 */
109 public function &__get( $name ) {
110 $value = '';
111
112 switch ( $name ) {
113 case 'dp' :
114 $value = wc_get_price_decimals();
115 break;
116 case 'prices_include_tax' :
117 $value = wc_prices_include_tax();
118 break;
119 case 'round_at_subtotal' :
120 $value = 'yes' === get_option( 'woocommerce_tax_round_at_subtotal' );
121 break;
122 case 'cart_contents_total' :
123 $value = $this->get_cart_contents_total();
124 break;
125 case 'total' :
126 $value = $this->get_total( 'edit' );
127 break;
128 case 'subtotal' :
129 $value = $this->get_subtotal() + $this->get_subtotal_tax();
130 break;
131 case 'subtotal_ex_tax' :
132 $value = $this->get_subtotal();
133 break;
134 case 'tax_total' :
135 $value = $this->get_fee_tax() + $this->get_cart_contents_tax();
136 break;
137 case 'fee_total' :
138 $value = $this->get_fee_total();
139 break;
140 case 'discount_cart' :
141 $value = $this->get_discount_total();
142 break;
143 case 'discount_cart_tax' :
144 $value = $this->get_discount_tax();
145 break;
146 case 'shipping_total' :
147 $value = $this->get_shipping_total();
148 break;
149 case 'shipping_tax_total' :
150 $value = $this->get_shipping_tax();
151 break;
152 case 'display_totals_ex_tax' :
153 case 'display_cart_ex_tax' :
154 $value = ! $this->display_prices_including_tax();
155 break;
156 case 'cart_contents_weight' :
157 $value = $this->get_cart_contents_weight();
158 break;
159 case 'cart_contents_count' :
160 $value = $this->get_cart_contents_count();
161 break;
162 case 'coupons' :
163 $value = $this->get_coupons();
164 break;
165
166 // Arrays returned by reference to allow modification without notices. TODO: Remove in 4.0.
167 case 'taxes' :
168 wc_deprecated_function( 'WC_Cart->taxes', '3.2', sprintf( 'getters (%s) and setters (%s)', 'WC_Cart::get_cart_contents_taxes()', 'WC_Cart::set_cart_contents_taxes()' ) );
169 $value = &$this->totals[ 'cart_contents_taxes' ];
170 break;
171 case 'shipping_taxes' :
172 wc_deprecated_function( 'WC_Cart->shipping_taxes', '3.2', sprintf( 'getters (%s) and setters (%s)', 'WC_Cart::get_shipping_taxes()', 'WC_Cart::set_shipping_taxes()' ) );
173 $value = &$this->totals[ 'shipping_taxes' ];
174 break;
175 case 'coupon_discount_amounts' :
176 $value = &$this->coupon_discount_totals;
177 break;
178 case 'coupon_discount_tax_amounts' :
179 $value = &$this->coupon_discount_tax_totals;
180 break;
181 case 'fees' :
182 wc_deprecated_function( 'WC_Cart->fees', '3.2', sprintf( 'the fees API (%s)', 'WC_Cart::get_fees' ) );
183
184 // Grab fees from the new API.
185 $new_fees = $this->fees_api()->get_fees();
186
187 // Add new fees to the legacy prop so it can be adjusted via legacy property.
188 $this->fees = $new_fees;
189
190 // Return by reference.
191 $value = &$this->fees;
192 break;
193 // Deprecated args. TODO: Remove in 4.0.
194 case 'tax' :
195 wc_deprecated_argument( 'WC_Cart->tax', '2.3', 'Use WC_Tax directly' );
196 $this->tax = new WC_Tax();
197 $value = $this->tax;
198 break;
199 case 'discount_total':
200 wc_deprecated_argument( 'WC_Cart->discount_total', '2.3', 'After tax coupons are no longer supported. For more information see: https://woocommerce.wordpress.com/2014/12/upcoming-coupon-changes-in-woocommerce-2-3/' );
201 $value = 0;
202 break;
203 case 'tax_display_cart':
204 wc_deprecated_argument( 'WC_Cart->tax_display_cart', '4.4', 'Use WC_Cart->get_tax_price_display_mode() instead.' );
205 $value = $this->get_tax_price_display_mode();
206 break;
207 }
208 return $value;
209 }
210
211 /**
212 * Map legacy variables to setters.
213 *
214 * @param string $name Property name.
215 * @param mixed $value Value to set.
216 */
217 public function __set( $name, $value ) {
218 switch ( $name ) {
219 case 'cart_contents_total' :
220 $this->set_cart_contents_total( $value );
221 break;
222 case 'total' :
223 $this->set_total( $value );
224 break;
225 case 'subtotal' :
226 $this->set_subtotal( $value );
227 break;
228 case 'subtotal_ex_tax' :
229 $this->set_subtotal( $value );
230 break;
231 case 'tax_total' :
232 $this->set_cart_contents_tax( $value );
233 $this->set_fee_tax( 0 );
234 break;
235 case 'taxes' :
236 $this->set_cart_contents_taxes( $value );
237 break;
238 case 'shipping_taxes' :
239 $this->set_shipping_taxes( $value );
240 break;
241 case 'fee_total' :
242 $this->set_fee_total( $value );
243 break;
244 case 'discount_cart' :
245 $this->set_discount_total( $value );
246 break;
247 case 'discount_cart_tax' :
248 $this->set_discount_tax( $value );
249 break;
250 case 'shipping_total' :
251 $this->set_shipping_total( $value );
252 break;
253 case 'shipping_tax_total' :
254 $this->set_shipping_tax( $value );
255 break;
256 case 'coupon_discount_amounts' :
257 $this->set_coupon_discount_totals( $value );
258 break;
259 case 'coupon_discount_tax_amounts' :
260 $this->set_coupon_discount_tax_totals( $value );
261 break;
262 case 'fees' :
263 wc_deprecated_function( 'WC_Cart->fees', '3.2', sprintf( 'the fees API (%s)', 'WC_Cart::add_fee' ) );
264 $this->fees = $value;
265 break;
266 default :
267 $this->$name = $value;
268 break;
269 }
270 }
271
272 /**
273 * Methods moved to session class in 3.2.0.
274 */
275 public function get_cart_from_session() { $this->session->get_cart_from_session(); }
276 public function maybe_set_cart_cookies() { $this->session->maybe_set_cart_cookies(); }
277 public function set_session() { $this->session->set_session(); }
278 public function get_cart_for_session() { return $this->session->get_cart_for_session(); }
279 public function persistent_cart_update() { $this->session->persistent_cart_update(); }
280 public function persistent_cart_destroy() { $this->session->persistent_cart_destroy(); }
281
282 /**
283 * Get the total of all cart discounts.
284 *
285 * @return float
286 */
287 public function get_cart_discount_total() {
288 return $this->get_discount_total();
289 }
290
291 /**
292 * Get the total of all cart tax discounts (used for discounts on tax inclusive prices).
293 *
294 * @return float
295 */
296 public function get_cart_discount_tax_total() {
297 return $this->get_discount_tax();
298 }
299
300 /**
301 * Renamed for consistency.
302 *
303 * @param string $coupon_code
304 * @return bool True if the coupon is applied, false if it does not exist or cannot be applied.
305 */
306 public function add_discount( $coupon_code ) {
307 return $this->apply_coupon( $coupon_code );
308 }
309 /**
310 * Remove taxes.
311 *
312 * @deprecated 3.2.0 Taxes are never calculated if customer is tax except making this function unused.
313 */
314 public function remove_taxes() {
315 wc_deprecated_function( 'WC_Cart::remove_taxes', '3.2', '' );
316 }
317 /**
318 * Init.
319 *
320 * @deprecated 3.2.0 Session is loaded via hooks rather than directly.
321 */
322 public function init() {
323 wc_deprecated_function( 'WC_Cart::init', '3.2', '' );
324 $this->get_cart_from_session();
325 }
326
327 /**
328 * Function to apply discounts to a product and get the discounted price (before tax is applied).
329 *
330 * @deprecated 3.2.0 Calculation and coupon logic is handled in WC_Cart_Totals.
331 * @param mixed $values Cart item.
332 * @param mixed $price Price of item.
333 * @param bool $add_totals Legacy.
334 * @return float price
335 */
336 public function get_discounted_price( $values, $price, $add_totals = false ) {
337 wc_deprecated_function( 'WC_Cart::get_discounted_price', '3.2', '' );
338
339 $cart_item_key = $values['key'];
340 $cart_item = $this->cart_contents[ $cart_item_key ];
341
342 return $cart_item['line_total'];
343 }
344
345 /**
346 * Gets the url to the cart page.
347 *
348 * @deprecated 2.5.0 in favor to wc_get_cart_url()
349 * @return string url to page
350 */
351 public function get_cart_url() {
352 wc_deprecated_function( 'WC_Cart::get_cart_url', '2.5', 'wc_get_cart_url' );
353 return wc_get_cart_url();
354 }
355
356 /**
357 * Gets the url to the checkout page.
358 *
359 * @deprecated 2.5.0 in favor to wc_get_checkout_url()
360 * @return string url to page
361 */
362 public function get_checkout_url() {
363 wc_deprecated_function( 'WC_Cart::get_checkout_url', '2.5', 'wc_get_checkout_url' );
364 return wc_get_checkout_url();
365 }
366
367 /**
368 * Sees if we need a shipping address.
369 *
370 * @deprecated 2.5.0 in favor to wc_ship_to_billing_address_only()
371 * @return bool
372 */
373 public function ship_to_billing_address_only() {
374 wc_deprecated_function( 'WC_Cart::ship_to_billing_address_only', '2.5', 'wc_ship_to_billing_address_only' );
375 return wc_ship_to_billing_address_only();
376 }
377
378 /**
379 * Coupons enabled function. Filterable.
380 *
381 * @deprecated 2.5.0
382 * @return bool
383 */
384 public function coupons_enabled() {
385 wc_deprecated_function( 'WC_Legacy_Cart::coupons_enabled', '2.5.0', 'wc_coupons_enabled' );
386 return wc_coupons_enabled();
387 }
388
389 /**
390 * Gets the total (product) discount amount - these are applied before tax.
391 *
392 * @deprecated 2.3.0 Order discounts (after tax) removed in 2.3 so multiple methods for discounts are no longer required.
393 * @return mixed formatted price or false if there are none.
394 */
395 public function get_discounts_before_tax() {
396 wc_deprecated_function( 'get_discounts_before_tax', '2.3', 'get_total_discount' );
397 if ( $this->get_cart_discount_total() ) {
398 $discounts_before_tax = wc_price( $this->get_cart_discount_total() );
399 } else {
400 $discounts_before_tax = false;
401 }
402 return apply_filters( 'woocommerce_cart_discounts_before_tax', $discounts_before_tax, $this );
403 }
404
405 /**
406 * Get the total of all order discounts (after tax discounts).
407 *
408 * @deprecated 2.3.0 Order discounts (after tax) removed in 2.3.
409 * @return int
410 */
411 public function get_order_discount_total() {
412 wc_deprecated_function( 'get_order_discount_total', '2.3' );
413 return 0;
414 }
415
416 /**
417 * Function to apply cart discounts after tax.
418 *
419 * @deprecated 2.3.0 Coupons can not be applied after tax.
420 * @param $values
421 * @param $price
422 */
423 public function apply_cart_discounts_after_tax( $values, $price ) {
424 wc_deprecated_function( 'apply_cart_discounts_after_tax', '2.3' );
425 }
426
427 /**
428 * Function to apply product discounts after tax.
429 *
430 * @deprecated 2.3.0 Coupons can not be applied after tax.
431 *
432 * @param $values
433 * @param $price
434 */
435 public function apply_product_discounts_after_tax( $values, $price ) {
436 wc_deprecated_function( 'apply_product_discounts_after_tax', '2.3' );
437 }
438
439 /**
440 * Gets the order discount amount - these are applied after tax.
441 *
442 * @deprecated 2.3.0 Coupons can not be applied after tax.
443 */
444 public function get_discounts_after_tax() {
445 wc_deprecated_function( 'get_discounts_after_tax', '2.3' );
446 }
447 }
448