Skip to content

Instantly share code, notes, and snippets.

@digamber89
digamber89 / functions.php
Created August 4, 2022 08:59
Zoom WooCommerce Appointments - add zoom link to ICS
<?php
function cm_20220801_add_zoom_link_to_ics( $ics_a, $appointment, $object ) {
$appointment_id = $appointment->get_id();
$meeting_details = json_decode( get_post_meta( $appointment_id, '_vczapi_woocommerce_appointments_meeting_details', true ) );
if ( empty( $meeting_details ) ) {
return $ics_a;
}
@digamber89
digamber89 / functions.php
Last active August 4, 2022 08:56
Zoom WooCommerce Appointments - Show Join via Browser only
<?php
function cm_220801_modified_gcal_sync( $data, $appointment ) {
remove_filter( 'woocommerce_appointments_gcal_sync', 'cm_220801_modified_gcal_sync' );
$data = '';
$appointment_id = $appointment->get_id();
$meeting_details = get_post_meta( $appointment_id, '_vczapi_woocommerce_appointments_meeting_details', true );
if ( ! empty( $meeting_details ) ) {
$meeting = json_decode( $meeting_details );
if ( is_object( $meeting ) ) {
@digamber89
digamber89 / main.js
Created April 13, 2022 09:53
Typesense - Analytics Middleware Hook
(function($){
document.addEventListener('tsfwc_search_state_changed', function (e) {
console.log('event',e.detail);
})
//jquery
$(document).on('click','.hit-content a',function(){
console.log(window.tsfwcSearchState);
})
@digamber89
digamber89 / functions.php
Created April 8, 2022 10:03
Change Recording Date Display
<?php
function cm_2022_04_08_change_recording_display( $display_date_time,$start_time, $timezone){
return vczapi_dateConverter($start_time,$timezone,'F j, Y',false);
}
add_filter('vczapi_wc_recording_start_time','cm_2022_04_08_change_recording_display',10,3);
@digamber89
digamber89 / functions.php
Created April 4, 2022 08:12
Skip a certain category from being indexed as a facet
<?php
function cm_tsfwc_20220404_skip_product_category( $formatted_data, $raw_data, $object_id ) {
$categories = get_the_terms( $raw_data->get_id(), 'product_cat' );
$category_names = [];
if ( ! empty( $categories ) ) {
foreach ( $categories as $category ) {
$parents_ids = get_ancestors( $category->term_id, 'product_cat' );
array_unshift( $parents_ids, $category->term_id );
foreach ( $parents_ids as $parent_id ) {
//replace 29 with the id of product category you do not want to index
@digamber89
digamber89 / main.js
Created March 28, 2022 07:24
Analytics Middleware - Typesense
(function ($) {
document.addEventListener('cmswt_search_state_changed', function (e) {
console.log('event',e.detail);
})
//jquery
$(document).on('click','.hit-content a',function(){
console.log(window.SearchWithTypesenseState);
})
@digamber89
digamber89 / wpml-compat.php
Created March 21, 2022 07:55
Add WPML Language
public function add_lang_facet( $formatted_data, $raw_data, $object_id ) {
//wpml compatibility check
$args = [ 'element_id' => $object_id, 'element_type' => 'post_id' ];
$language = apply_filters( 'wpml_element_language_code', null, $args );
if ( $language !== null ) {
$formatted_data['lang_attribute_filter'] = [ $language ];
}
return $formatted_data;
}
@digamber89
digamber89 / zoom-listing.php
Created March 8, 2022 05:40
Change Meeting link to Product Link
<?php
/**
* The Template for displaying all single meetings
*
* This template can be overridden by copying it to yourtheme/video-conferencing-zoom/shortcode/zoom-listing.php.
*
* @package Video Conferencing with Zoom API/Templates
* @version 3.2.2
* @updated 3.6.0
*/
@digamber89
digamber89 / functions.php
Last active February 25, 2022 06:35
Disable Join via App Zoom
<?php
//disable join via app
add_filter('vczoom_join_meeting_via_app_disable','__return_true');
//disable join via browser - browser notices
add_filter('vczapi_api_bypass_notice','__return_true');
@digamber89
digamber89 / filters.php
Last active February 25, 2022 05:41
Adding Custom Fields for Typesense Search for WooCommerce
<?php
/*Add to Product Schema*/
function image_store_add_product_fields( $product_fields ) {
$product_fields[] = [ 'name' => 'image_url', 'type' => 'string', 'optional' => true, 'index' => false ];
return $product_fields;
}
add_filter( 'cm_tsfwc_product_fields', 'image_store_add_product_fields' );