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 / Webhooks.php
Created November 21, 2022 21:09
Stripe Webhook secret response display
<?php
/**
* Replace the file located at: src/Tickets/Commerce/Gateways/Stripe/Webhooks.php
**/
namespace TEC\Tickets\Commerce\Gateways\Stripe;
use TEC\Tickets\Commerce\Gateways\Contracts\Abstract_Gateway;
use TEC\Tickets\Commerce\Gateways\Contracts\Abstract_Merchant;
use TEC\Tickets\Commerce\Gateways\Contracts\Abstract_Webhooks;
use TEC\Tickets\Commerce\Gateways\Stripe\REST\Webhook_Endpoint;
@rafsuntaskin
rafsuntaskin / functions.php
Created July 6, 2022 16:34
Fix Checkout URL for Failed Order re-payment
<?php
// patch for Ticket# GTRIA-802
//remove the original filter
add_action( 'wp', 'rt_et_remove_tribe_filter', 99 );
function rt_et_remove_tribe_filter() {
$woo_cart = tribe( 'tickets-plus.commerce.woo.cart' );
remove_filter( 'woocommerce_get_checkout_url', [
$woo_cart,
@rafsuntaskin
rafsuntaskin / functions.php
Created July 6, 2022 15:08
Attendee Fatal error data recovery
<?php
/**
* In some cases where the user input for purchaser name is corrputed we need to
* replace the purhcaser name with purchaser email.
*/
add_filter( 'tribe_tickets_attendee_data', 'rt_et_filter_corrupted_attendee', 10, 4 );
function rt_et_filter_corrupted_attendee( $attendee_data, $provider, $attendee, $post_id ) {
@rafsuntaskin
rafsuntaskin / functions.php
Last active July 3, 2022 22:14
PDF Tickets extension - Woo attachments filter by attendee
<?php
add_filter( 'tribe_tickets_ticket_email_attachments', 'filter_woo_pdf_attachments_by_attendee', 10, 6 );
function filter_woo_pdf_attachments_by_attendee( $attachments, $post_id, $order_id, $tickets, $provider, $args ) {
$order = wc_get_order( $order_id );
if ( ! $order ) {
return $attachments;
@rafsuntaskin
rafsuntaskin / patch.php
Created May 25, 2022 21:20
Metabox View plugin breaking Attendee Registration page
<?php
add_action( 'init', 'rafsuntaskin_disable_metabox_views_on_ar_page', 2 );
function rafsuntaskin_disable_metabox_views_on_ar_page() {
if ( isset( $_GET['tickets_provider'] ) ) {
remove_action( 'init', 'mb_views_load', 5 );
}
}
@rafsuntaskin
rafsuntaskin / functions.php
Created April 6, 2022 22:01
WP Engine RSVP meta not working
<?php
add_action( 'event_tickets_rsvp_ticket_created', 'etp_process_front_end_rsvp_tickets_form_data', 8 );
function etp_process_front_end_rsvp_tickets_form_data() {
$storage = tribe( 'tickets-plus.meta.storage' );
$storage->maybe_set_attendee_meta_cookie();
}
@rafsuntaskin
rafsuntaskin / functions.php
Created March 31, 2022 16:34
limit RSVP max purchases for ET
<?php
add_filter( 'tribe_tickets_get_ticket_max_purchase', 'et_set_max_rsvp_purchase_limit', 10, 4 );
function et_set_max_rsvp_purchase_limit( $available_at_a_time, $ticket, $event, $ticket_id ) {
if ( $available_at_a_time <= 1 || $ticket->provider_class != 'Tribe__Tickets__RSVP' ) {
return $available_at_a_time;
}
@rafsuntaskin
rafsuntaskin / functions.php
Last active October 15, 2023 08:34
Plain Ticket Meta data on WooCommerce Order data
<?php
add_action( 'woocommerce_order_status_changed', 'etp_modify_saved_order_meta', 10, 2 );
function etp_modify_saved_order_meta( $order_id, $from_status = null ) {
if ( ! class_exists( 'Tribe__Tickets_Plus__Meta' ) ) {
return;
}
$order = wc_get_order( $order_id );
@rafsuntaskin
rafsuntaskin / functions.php
Last active March 16, 2022 05:09
Woo 6.3.0 AR page fix
<?php
add_filter( 'woocommerce_is_rest_api_request', 'simulate_as_not_rest' );
/**
* Mock REST request as frontend to load cart session.
*
* Since WooCommerce 6.3.0
*
* @param bool $is_rest_api_request
* @return bool
@rafsuntaskin
rafsuntaskin / functions.php
Created September 25, 2021 07:48
QR Code ticket URL conflict Fix - A
<?php
add_filter( 'tribe_tickets_qr_code_base_url', function( $url ) {
return site_url( '/' );
} );