| @@ -51,8 +51,11 @@ | ||
| 51 | 51 | |
| 52 | 52 | add_filter( 'timetics_currency', [ $this, 'support_woocommerce_currency' ] ); |
| 53 | 53 | |
| 54 | 54 | add_action( 'admin_init', [ $this, 'create_term_timetics_meeting' ] ); |
| 55 | + | |
| 56 | + add_action( 'wp_head', [ $this, 'hide_regular_price_checkout_css' ] ); | |
| 57 | + | |
| 55 | 58 | } |
| 56 | 59 | |
| 57 | 60 | /** |
| 58 | 61 | * Load all required files and functions |
| @@ -112,13 +115,19 @@ | ||
| 112 | 115 | 'payment_method' => 'woocommerce', |
| 113 | 116 | ] ); |
| 114 | 117 | |
| 115 | 118 | $booking->create_event(); |
| 116 | - $new_event_email = new New_Event_Email( $booking ); | |
| 117 | - $new_event_email->send(); | |
| 119 | + $is_email_to_customer = timetics_get_option( 'booking_created_customer'); | |
| 120 | + $is_email_to_host = timetics_get_option( 'booking_created_host'); | |
| 121 | + if( $is_email_to_host ){ | |
| 122 | + $new_event_email = new New_Event_Email( $booking ); | |
| 123 | + $new_event_email->send(); | |
| 124 | + } | |
| 118 | 125 | |
| 119 | - $new_event_customer_email = new New_Event_Customer_Email( $booking ); | |
| 120 | - $new_event_customer_email->send(); | |
| 126 | + if( $is_email_to_customer ){ | |
| 127 | + $new_event_customer_email = new New_Event_Customer_Email( $booking ); | |
| 128 | + $new_event_customer_email->send(); | |
| 129 | + } | |
| 121 | 130 | |
| 122 | 131 | WC()->session->set( 'timetics_data', null ); |
| 123 | 132 | |
| 124 | 133 | } |
| @@ -306,8 +315,13 @@ | ||
| 306 | 315 | } |
| 307 | 316 | |
| 308 | 317 | $booking = new Booking( $booking_id ); |
| 309 | 318 | $meeting_id = $booking->get_appointment(); |
| 319 | + if( !empty($data['seats']) && is_array( $data['seats'])) { | |
| 320 | + $quantity = count( $data['seats'] ); | |
| 321 | + }else { | |
| 322 | + $quantity = 1; | |
| 323 | + } | |
| 310 | 324 | $price = $booking->get_total(); |
| 311 | 325 | |
| 312 | 326 | |
| 313 | 327 | // Set session for timetics data for woocommerce. |
| @@ -322,10 +336,10 @@ | ||
| 322 | 336 | |
| 323 | 337 | // Preparing for add to cart. |
| 324 | 338 | $meeting = new Appointment( $meeting_id ); |
| 325 | 339 | $product_id = $meeting->get_wc_product_id(); |
| 326 | - $quantity = 1; | |
| 327 | 340 | |
| 341 | + | |
| 328 | 342 | if ( ! $product_id ) { |
| 329 | 343 | $product = new Product(); |
| 330 | 344 | $product_id = $product->create( $meeting ); |
| 331 | 345 | } |
| @@ -369,6 +383,30 @@ | ||
| 369 | 383 | } |
| 370 | 384 | |
| 371 | 385 | // Create new woocommerce product category for timetics meeting |
| 372 | 386 | timetics_add_woocommerce_product_cat(); |
| 387 | + } | |
| 388 | + | |
| 389 | + public function hide_regular_price_checkout_css() { | |
| 390 | + $session = WC()->session; | |
| 391 | + if ( (is_checkout() || is_cart()) && $session ) { | |
| 392 | + $timetics_data = $session->get('timetics_data'); | |
| 393 | + if( isset($timetics_data) ) { | |
| 394 | + ?> | |
| 395 | + <style type="text/css"> | |
| 396 | + .wc-block-components-order-summary .wc-block-components-order-summary-item__individual-prices { | |
| 397 | + display: none; | |
| 398 | + } | |
| 399 | + .wc-block-cart-item__prices, | |
| 400 | + .woocommerce-cart-form__cart-item.cart_item .product-price { | |
| 401 | + display: none; | |
| 402 | + } | |
| 403 | + .wc-block-cart-item__quantity, | |
| 404 | + .woocommerce-cart-form__cart-item.cart_item .product-quantity { | |
| 405 | + display: none; | |
| 406 | + } | |
| 407 | + </style> | |
| 408 | + <?php | |
| 409 | + } | |
| 410 | + } | |
| 373 | 411 | } |
| 374 | 412 | } |