Templates
1 month ago
TranslationEditor
1 month ago
Calendar.php
1 year ago
Emails.php
1 month ago
Factory.php
1 month ago
MulticurrencyHooks.php
1 month ago
Prices.php
1 month ago
SharedHooks.php
1 month ago
Slots.php
1 month ago
class-wcml-accommodation-bookings.php
1 month ago
class-wcml-bookings.php
1 month ago
Prices.php
25 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Compatibility\WcBookings; |
| 4 | |
| 5 | class Prices implements \IWPML_Action { |
| 6 | |
| 7 | const CUSTOM_COSTS_STATUS_KEY = '_wcml_custom_costs_status'; |
| 8 | |
| 9 | public function add_hooks() { |
| 10 | add_filter( 'wcml_product_has_custom_prices', [ $this, 'checkCustomCosts' ], 10, 2 ); |
| 11 | } |
| 12 | |
| 13 | public function checkCustomCosts( $check, $productId ) { |
| 14 | if ( ! $check ) { |
| 15 | $product = wc_get_product( $productId ); |
| 16 | if ( $product && 'booking' === $product->get_type() ) { |
| 17 | $check = get_post_meta( $productId, self::CUSTOM_COSTS_STATUS_KEY, true ); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | return $check; |
| 22 | } |
| 23 | |
| 24 | } |
| 25 |