Skip to content

Instantly share code, notes, and snippets.

View kartikparmar's full-sized avatar

Kartik Parmar kartikparmar

  • Mumbai
View GitHub Profile
<?php
$consumer_key = 'ck_b6dab226d72e3b3da3462f9b51bc672b886f8f85';
$consumer_secret = 'cs_912b18aeedb2883a9c53f877a3c77fc7c0082fc4';
$url = rest_url( 'wp/v2/bkap-bookings/16180/' );
$url = add_query_arg(
array(
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret
),
@kartikparmar
kartikparmar / functions.php
Created March 23, 2021 19:55
Show total and remaining amount on the front end product page.
function bkap_appending_additional_information_to_price( $display_price, $wp_send_json ) {
$total = $wp_send_json['total_price_calculated'];
$price = $wp_send_json['bkap_price_charged'];
if ( $total != $price ) {
$wc_price_args = bkap_common::get_currency_args();
$remaining = $total - $price;
$total_label = get_option( 'bkap_total_amt_label', '' );
$total_display = $total_label . wc_price( $total, $wc_price_args ) . '<br>'; // Total Price.
$remaining_label = get_option( 'bkap_remaining_amt_label', '' );
<?php
[0] => Array
(
[id] => 15586
[title] => Sunday Reopen
[url] => https://localhost/rental/product/sunday-reopen-2/
[allDay] =>
[rrule] => Array
(
jQuery( document ).ready(function($) {
const calendarEl = document.getElementById( 'calendar' );
var cal = new FullCalendar.Calendar(calendarEl, {
noEventsMessage: 'No Events',
timeZone: 'Europe/London',
plugins: [ 'rrule', 'dayGrid','list' ],
header: {"left":"title","center":"","right":"prev,next"},
defaultView: 'listWeek',
loading: function (isLoading) {
bkapListing.loading( isLoading, false )
@kartikparmar
kartikparmar / functions.php
Created December 14, 2020 05:32
Setting minimum quantity when adding the product to cart from shop page.
<?php
function loop_add_to_cart_args_callback( $args, $product ) {
$product_id = $product->get_id();
$product_min = wc_get_product_min_limit( $product_id );
if ( $product_min ) {
$args['quantity'] = $product_min;
}
@kartikparmar
kartikparmar / functions.php
Last active November 23, 2020 15:02
Updating Booking Status - Rich
<?php
function woocommerce_thankyou_change_order_status( $order_id ) {
if ( ! $order_id ) return;
$order = wc_get_order( $order_id );
if ( $order->get_status() == 'processing' ){
$order->update_status( 'pending' );
@kartikparmar
kartikparmar / functions.php
Created July 22, 2020 06:34
Changing the steps quantity to 2 for all the WooCommerce products
<?php
/*
* Changing the steps quantity to 2 for all the WooCommerce products
*/
function woocommerce_quantity_input_step_callback( $step, $product ) {
$step = 2;
return $step;
}
@kartikparmar
kartikparmar / functions.php
Created June 13, 2020 16:52
Change Proceed to Checkout button
<?php
function woocommerce_button_proceed_to_checkout(){
?>
<a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="checkout-button button alt wc-forward">
<?php esc_html_e( 'Proceed to Make Payment', 'woocommerce' ); ?>
</a>
<?php
}
@kartikparmar
kartikparmar / functions.php
Created June 13, 2020 16:25
Do not allow product to be purchased if particular is present in the cart.
<?php
function wc_purchasable_or_not( $product_id, $status = true ) {
// key : ID of Product where you want to hide Add to Cart.
// value : Array of Product IDs which are present in the cart then hide Add to Cart button for Product ID set in key
$product_check = array(
'2701' => array( '2848', '2563', '1253' ),
'2245' => array( '2848', '2563', '1253' ),
@kartikparmar
kartikparmar / functions.php
Created June 12, 2020 11:23
Changing pickup fields label
<?php
function orddd_change_pickup_date_label_callback(){
return __( 'New Pickup Date Label', 'order-pickup-date' );
}
add_filter( 'orddd_change_pickup_date_label', 'orddd_change_pickup_date_label_callback' );
function orddd_change_pickup_time_label_callback(){
return __( 'New Pickup Time Slot Label', 'order-pickup-date' );