← All changes
|
src/Addons/RoleBasedPricing/RoleBasedPriceManager.php
+24
-1
6.1.0
→
8.0.2
View file →
| @@ -37,8 +37,11 @@ | ||
| 37 | 37 | delete_post_meta( $productId, "_{$role}_tiered_price_rules_type" ); |
| 38 | 38 | |
| 39 | 39 | delete_post_meta( $productId, "_{$role}_tiered_price_minimum_qty" ); |
| 40 | 40 | |
| 41 | + delete_post_meta( $productId, "_{$role}_tiered_price_tax_status" ); | |
| 42 | + delete_post_meta( $productId, "_{$role}_tiered_price_tax_class" ); | |
| 43 | + | |
| 41 | 44 | do_action( 'tiered_pricing_table/role_based_rules/delete_role_rule', $productId, $role ); |
| 42 | 45 | } |
| 43 | 46 | |
| 44 | 47 | public static function deleteAllRoleDataForProduct( int $productId ) { |
| @@ -59,9 +62,9 @@ | ||
| 59 | 62 | return self::getPriceRules( $productId, $role, 'fixed', $context ); |
| 60 | 63 | } |
| 61 | 64 | |
| 62 | 65 | /** |
| 63 | - * Return empty array if rules do not exist. | |
| 66 | + * Return an empty array if rules do not exist. | |
| 64 | 67 | */ |
| 65 | 68 | public static function getPercentagePriceRules( int $productId, string $role, string $context = 'view' ): array { |
| 66 | 69 | return self::getPriceRules( $productId, $role, 'percentage', $context ); |
| 67 | 70 | } |
| @@ -188,6 +191,26 @@ | ||
| 188 | 191 | $productId ); |
| 189 | 192 | } |
| 190 | 193 | |
| 191 | 194 | return $pricingType; |
| 195 | + } | |
| 196 | + | |
| 197 | + public static function getProductTaxStatus( int $productId, string $role, string $context = 'view' ): string { | |
| 198 | + $taxStatus = get_post_meta( $productId, "_{$role}_tiered_price_tax_status", true ); | |
| 199 | + | |
| 200 | + if ( 'edit' !== $context ) { | |
| 201 | + return apply_filters( 'tiered_pricing_table/role_based_rules/price/tax_status', $taxStatus, $role, $productId ); | |
| 202 | + } | |
| 203 | + | |
| 204 | + return $taxStatus; | |
| 205 | + } | |
| 206 | + | |
| 207 | + public static function getProductTaxClass( int $productId, string $role, string $context = 'view' ): string { | |
| 208 | + $taxClass = get_post_meta( $productId, "_{$role}_tiered_price_tax_class", true ); | |
| 209 | + | |
| 210 | + if ( 'edit' !== $context ) { | |
| 211 | + return apply_filters( 'tiered_pricing_table/role_based_rules/price/tax_class', $taxClass, $role, $productId ); | |
| 212 | + } | |
| 213 | + | |
| 214 | + return $taxClass; | |
| 192 | 215 | } |
| 193 | 216 | } |