This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: WooCommerce Box Office - Link Guest Tickets to Registered Users | |
| * Plugin URI: https://gist.github.com/stuartduff/c6a4abc3dd52402e86d5efdb122707f0/edit | |
| * Description: Links tickets purchased as a guest to the customer's account when they register using the same email address. | |
| * Version: 1.0.0 | |
| * Author: Stuart Duff | |
| * Author URI: https:/stuartduff.com | |
| * License: GPL v2 or later | |
| * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add_cc_to_invoice_email($headers, $email_id, $order) { | |
| if ($email_id === 'customer_invoice') { | |
| $cc_email = 'cc@example.com'; // Replace with the email you want to CC | |
| $headers .= 'Cc: ' . $cc_email . "\r\n"; | |
| } | |
| return $headers; | |
| } | |
| add_filter('woocommerce_email_headers', 'add_cc_to_invoice_email', 10, 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add_additonal_wc_mime_types($mime_types) { | |
| $mime_types['webp'] = 'image/webp'; // Add support for webp images in the WooCommerce Product importer. | |
| return $mime_types; | |
| } | |
| add_filter('woocommerce_rest_allowed_image_mime_types', 'add_additonal_wc_mime_types', 1, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Add "Products" to Stripe metadata | |
| */ | |
| function filter_wc_stripe_payment_metadata( $metadata, $order, $source ) { | |
| $count = 1; | |
| foreach( $order->get_items() as $item_id => $line_item ){ | |
| $item_data = $line_item->get_data(); | |
| $product = $line_item->get_product(); | |
| $product_name = $product->get_name(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('woocommerce_add_to_cart_validation', 'check_num_of_subscriptions', 10, 2); | |
| function check_num_of_subscriptions( $valid, $product_id ) | |
| { | |
| $product_to_add = wc_get_product( $product_id ); | |
| if ( $product_to_add instanceof WC_Product_Subscription || $product_to_add instanceof WC_Product_Variable_Subscription) { | |
| // alternative use: $has_sub = wcs_user_has_subscription( '', '', 'active' ); | |
| if ( has_active_subscription() ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // show newest product reviews on top | |
| function sd_newest_reviews_first( $args ) { | |
| $args['reverse_top_level'] = true; | |
| return $args; | |
| } | |
| add_filter( 'woocommerce_product_review_list_args', 'sd_newest_reviews_first' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function remove_handheld_search( $links ) { | |
| unset( $links['search'] ); | |
| return $links; | |
| } | |
| add_filter( 'storefront_handheld_footer_bar_links', 'remove_handheld_search' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function storefront_product_search() { | |
| if ( storefront_is_woocommerce_activated() ) { | |
| ?> | |
| <div class="site-search"> | |
| <?php the_widget( 'WP_Widget_Search', 'title=' ); ?> | |
| </div> | |
| <?php | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function remove_wc_stripe_from_checkout_page( $available_gateways ) { | |
| unset( $available_gateways['stripe'] ); | |
| return $available_gateways; | |
| } | |
| add_filter( 'woocommerce_available_payment_gateways', 'remove_wc_stripe_from_checkout_page' ); |
NewerOlder