Skip to content

Instantly share code, notes, and snippets.

View rafsuntaskin's full-sized avatar
🎯
Focusing

Rafsun Chowdhury rafsuntaskin

🎯
Focusing
View GitHub Profile
@rafsuntaskin
rafsuntaskin / functions.php
Last active September 3, 2021 13:13
Fix Woo Payments and ET fatal error
<?php
add_filter( 'tribe_tickets_block_ticket_html_attributes', 'rt_et_woo_payments_fatal_fix' );
function rt_et_woo_payments_fatal_fix( $attrs ) {
if ( ! isset( $attrs['data-ticket-price'] ) ) {
return $attrs;
}
$attrs['data-ticket-price'] = (string) $attrs['data-ticket-price'];
@rafsuntaskin
rafsuntaskin / functions.php
Last active March 22, 2022 09:34
Varnish cache bypass
<?php
$regex_path_patterns = array(
'#^/attendee-registration/?#',
'#^/tickets-checkout/?#',
);
// Loop through the patterns.
foreach ($regex_path_patterns as $regex_path_pattern) {
if (preg_match($regex_path_pattern, $_SERVER['REQUEST_URI'])) {
@rafsuntaskin
rafsuntaskin / functions.php
Created August 5, 2021 16:50
CT conflict fix with Woo Enhanced Templates
<?php
add_action( 'init', 'rt_ct_fix_woo_template_conflict', 99 );
function rt_ct_fix_woo_template_conflict() {
if ( class_exists( 'Tribe__Events__Community__Tickets__Main' ) ) {
remove_action( 'woocommerce_order_item_meta_start', [ Tribe__Events__Community__Tickets__Main::instance(), 'add_order_item_details' ], 10 );
}
}
@rafsuntaskin
rafsuntaskin / functions.php
Created July 29, 2021 21:15
CT change all Pending status payouts to completed by changing any order status to completed
<?php
add_action( 'woocommerce_order_status_changed', 'rt_ct_reset_failed_payouts', 9, 4 );
function rt_ct_reset_failed_payouts( $order_id, $status_from, $status_to, $order ) {
global $wpdb;
if ( 'completed' == $status_to ) {
$query = $wpdb->query( "UPDATE $wpdb->posts SET post_status = 'tribe-payout-paid' WHERE post_status = 'tribe-payout-pending'" );
}
}
@rafsuntaskin
rafsuntaskin / functions.php
Created July 9, 2021 20:12
Woo New Order Fatal error patch for ET+
<?php
/**
* Temporary fix for Fatal error when adding new order in WooCommerce with Event Tickets Plus v5.2.7
*/
add_action( 'init', 'rt_patch_for_attendee_regeneration', 99 );
function rt_patch_for_attendee_regeneration() {
remove_filter( 'woocommerce_order_actions', [ tribe( 'tickets-plus.commerce.woo.regenerate-order-attendees' ), 'add_single_order_action' ] );
add_filter( 'woocommerce_order_actions', 'rt_patch_regenerate_actions' );
@rafsuntaskin
rafsuntaskin / functions.php
Created April 27, 2021 18:07
MA patch for ET+
<?php
add_filter( 'tribe_asset_pre_register', 'rt_et_patch_ma_nonce', 99 );
function rt_et_patch_ma_nonce( $assets ) {
if ( ! in_array( 'event-tickets-admin', $assets->groups ) ) {
return $assets;
}
@rafsuntaskin
rafsuntaskin / functions.php
Last active April 12, 2022 18:06
PDF Tickets - unlink error patch
<?php
add_filter( 'tribe_ext_pdf_tickets_mpdf_args', function( $args ) {
$upload_dir = wp_upload_dir();
$args['tempDir'] = $upload_dir['basedir'] . '/tmp/';
return $args;
} );
@rafsuntaskin
rafsuntaskin / functions.php
Created April 12, 2021 20:39
Change Event Tickets CSV export delimiter
<?php
add_filter( 'tribe_tickets_attendees_csv_export_delimiter', 'rt_et_change_csv_export_delimiter' );
function rt_et_change_csv_export_delimiter( $default ) {
return '.';
}
@rafsuntaskin
rafsuntaskin / functions.php
Created February 10, 2021 23:12
Disable Event Timestamp & date for Ticket Email
<?php
add_filter( 'tribe_tickets_email_include_event_date', '__return_false' );
@rafsuntaskin
rafsuntaskin / functions.php
Created October 16, 2020 10:02
Hide default Ticket form for Event Tickets
<?php
add_filter( 'tribe_tickets_commerce_tickets_form_hook', function ( $hook ) {
return 'tribe_random_hook_to_hide_ticket_form';
} );