Skip to content

Instantly share code, notes, and snippets.

@kartikparmar
Created June 9, 2022 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kartikparmar/16292d35e8733fac28920c1877175fcd to your computer and use it in GitHub Desktop.
Save kartikparmar/16292d35e8733fac28920c1877175fcd to your computer and use it in GitHub Desktop.
Adding Special Price to Variable Price
<?php
/**
* Adding Special Price to Variable Price.
*
* @param string $time_slot_price Booking Price.
* @param string $product_id Product ID.
* @param string $variation_id Variable ID.
* @param string $product_type Product type.
*
* @return string $time_slot_price Modified Booking Price.
*/
function bkap_add_special_price_to_variation( $time_slot_price, $product_id, $variation_id, $product_type ) {
if ( isset( $_POST['special_booking_price'] ) && '' != $_POST['special_booking_price'] ) {
$time_slot_price = bkap_common::bkap_get_price( $product_id, $variation_id, $product_type );
$time_slot_price += $_POST['special_booking_price'];
}
return $time_slot_price;
}
add_filter( 'bkap_modify_booking_price', 'bkap_add_special_price_to_variation', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment