| 1 |
<?php namespace TierPricingTable\Integrations\Plugins; |
| 2 |
|
| 3 |
class DiscountRulesForWooCommerce extends PluginIntegrationAbstract { |
| 4 |
|
| 5 |
public function run() { |
| 6 |
|
| 7 |
add_filter( 'tiered_pricing_table/cart/need_price_recalculation', function ( $recalculate, $cartItem ) { |
| 8 |
if ( isset( $cartItem['wdr_free_product'] ) ) { |
| 9 |
return false; |
| 10 |
} |
| 11 |
|
| 12 |
return $recalculate; |
| 13 |
}, 10, 2 ); |
| 14 |
|
| 15 |
add_filter( 'tiered_pricing_table/cart/need_price_recalculation/item', function ( $recalculate, $cartItem ) { |
| 16 |
if ( isset( $cartItem['wdr_free_product'] ) ) { |
| 17 |
return false; |
| 18 |
} |
| 19 |
|
| 20 |
return $recalculate; |
| 21 |
}, 10, 2 ); |
| 22 |
} |
| 23 |
|
| 24 |
public function addToIntegrationsSettings( $integrations ) { |
| 25 |
return $integrations; |
| 26 |
} |
| 27 |
|
| 28 |
public function getIconURL(): string { |
| 29 |
return ''; |
| 30 |
} |
| 31 |
|
| 32 |
public function getAuthorURL(): string { |
| 33 |
return 'https://wordpress.org/plugins/woo-discount-rules/'; |
| 34 |
} |
| 35 |
|
| 36 |
public function getTitle(): string { |
| 37 |
return __( 'Discount Rules for WooCommerce', 'tier-pricing-table' ); |
| 38 |
} |
| 39 |
|
| 40 |
public function getDescription(): string { |
| 41 |
return __( 'Prevent price recalculations for free promotional items added to the cart by Discount Rules for WooCommerce.', 'tier-pricing-table' ); |
| 42 |
} |
| 43 |
|
| 44 |
public function getSlug(): string { |
| 45 |
return 'discount-rules-for-woocommerce'; |
| 46 |
} |
| 47 |
|
| 48 |
public function getIntegrationCategory(): string { |
| 49 |
return 'other'; |
| 50 |
} |
| 51 |
} |
| 52 |
|