Skip to content

Instantly share code, notes, and snippets.

View ashokrane's full-sized avatar

Vishal Kothari ashokrane

View GitHub Profile
@ashokrane
ashokrane / code2.gs
Created July 19, 2019 22:07
Google apps script for integration of WooCommece orders to Google sheets.
//this is a function that fires when the webapp receives a GET request
function doGet(e) {
return HtmlService.createHtmlOutput("request received");
}
//this is a function that fires when the webapp receives a POST request
function doPost(e) {
var myData = JSON.parse([e.postData.contents]);
var order_number = myData.number;
var order_created = myData.date_created;
@ashokrane
ashokrane / seasonal-addon-price-on-cart-checkout-page.php
Created January 19, 2022 13:05
Seasonal Addon Price on Cart & Checkout page
function bkap_woocommerce_cart_item_subtotal( $product_subtotal, $cart_item, $cart_item_key ) {
if ( isset( $cart_item['bkap_booking'] ) ) {
$booking = $cart_item['bkap_booking'][0];
if ( isset( $booking[ 'hidden_date_checkout' ] ) ) {
$checkin_date_str = strtotime( $booking[ 'hidden_date' ] );
$checkout_date_str = strtotime( $booking[ 'hidden_date_checkout' ] );
$checkin_date = date( 'Y-m-d', $checkin_date_str );
$checkout_date = date( 'Y-m-d', $checkout_date_str );