PluginProbe
Tiered Pricing Table for WooCommerce / 6.4.0
Tiered Pricing Table for WooCommerce v6.4.0
8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 All 91 releases
tier-pricing-table / src / Integrations / Plugins / WCCS.php

WCCS.php in Tiered Pricing Table for WooCommerce 6.4.0, at src/Integrations/Plugins/WCCS.php

69 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Integrations\Plugins;
2
3 use TierPricingTable\PriceManager;
4
5 class WCCS extends PluginIntegrationAbstract {
6
7 public function run() {
8
9 add_filter( 'tiered_pricing_table/price/price_by_rules',
10 function ( $product_price, $quantity, $product_id, $context ) {
11
12 global $WCCS;
13
14 if ( $WCCS ) {
15
16 $product = wc_get_product( $product_id );
17
18 if ( 'view' === $context && $product ) {
19 return $WCCS->wccs_custom_price( $product_price, $product );
20 }
21 }
22
23 return $product_price;
24
25 }, 10, 10 );
26
27 add_filter( 'tiered_pricing_table/cart/product_cart_price',
28 function ( $price, $cartItem, $cartItemKey, $totalQuantity ) {
29
30 global $WCCS;
31
32 if ( ! $WCCS ) {
33 return $price;
34 }
35
36 if ( $price ) {
37 return PriceManager::getPriceByRules( $totalQuantity, $cartItem['data']->get_id(), 'edit', 'cart',
38 false );
39 }
40
41 return $price;
42 }, 10, 4 );
43 }
44
45 public function getTitle(): string {
46 return 'WooCommerce Currency Switcher by WP Experts (WCCS)';
47 }
48
49 public function getDescription(): string {
50 return __( 'Convert and display tiered pricing correctly when using the WooCommerce Currency Switcher by WP Experts.', 'tier-pricing-table' );
51 }
52
53 public function getIconURL(): string {
54 return $this->getContainer()->getFileManager()->locateAsset( 'admin/integrations/wccs-icon.png' );
55 }
56
57 public function getAuthorURL(): string {
58 return 'https://woocommerce.com/products/currency-switcher-for-woocommerce/';
59 }
60
61 public function getSlug(): string {
62 return 'wccs';
63 }
64
65 public function getIntegrationCategory(): string {
66 return 'multicurrency';
67 }
68 }
69