PluginProbe
Tiered Pricing Table for WooCommerce / trunk
Tiered Pricing Table for WooCommerce vtrunk
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 2.3.4 All 90 releases
tier-pricing-table / src / Integrations / Plugins / AddifyRequestAQuote.php

AddifyRequestAQuote.php in Tiered Pricing Table for WooCommerce trunk, at src/Integrations/Plugins/AddifyRequestAQuote.php

48 lines 1.3 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 use WC_Product;
5
6 class AddifyRequestAQuote extends PluginIntegrationAbstract {
7
8 public function run() {
9 add_filter( 'addify_quote_item_product', function ( WC_Product $product, $quoteItem ) {
10 $quantity = $quoteItem['quantity'] ? intval( $quoteItem['quantity'] ) : 1;
11
12 $pricingRule = PriceManager::getPricingRule( $product->get_id() );
13
14 $price = $pricingRule->getTierPrice( $quantity, false, 'cart' );
15
16 if ( $price ) {
17 $product->set_price( $price );
18 }
19
20 return $product;
21 }, 10, 2 );
22 }
23
24 public function getIconURL(): string {
25 return $this->getContainer()->getFileManager()->locateAsset( 'admin/integrations/addify-raq-icon.png' );
26 }
27
28 public function getAuthorURL(): string {
29 return 'https://woocommerce.com/products/request-a-quote-plugin-for-woocommerce/';
30 }
31
32 public function getTitle(): string {
33 return 'Request a Quote for WooCommerce by Addify';
34 }
35
36 public function getDescription(): string {
37 return __( 'Apply tiered pricing discounts when users request a quote through the Addify Request a Quote form.', 'tier-pricing-table' );
38 }
39
40 public function getSlug(): string {
41 return 'addify-request-a-quote';
42 }
43
44 public function getIntegrationCategory(): string {
45 return 'other';
46 }
47 }
48